diff options
Diffstat (limited to 'dbaccess/source/core/api')
59 files changed, 1435 insertions, 2809 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx index e8964693a..f9cf63233 100644 --- a/dbaccess/source/core/api/BookmarkSet.cxx +++ b/dbaccess/source/core/api/BookmarkSet.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,11 +43,9 @@ using namespace ::dbtools; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; -// using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; -// using namespace ::cppu; using namespace ::osl; void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter) @@ -55,43 +54,43 @@ void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet,const ::r OCacheSet::construct(_xDriverSet,i_sRowSetFilter); m_xRowLocate.set(_xDriverSet,UNO_QUERY); } -// ----------------------------------------------------------------------------- + Any SAL_CALL OBookmarkSet::getBookmark() throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::getBookmark" ); return m_xRowLocate->getBookmark(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OBookmarkSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveToBookmark" ); return m_xRowLocate->moveToBookmark(bookmark); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OBookmarkSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveRelativeToBookmark" ); return m_xRowLocate->moveRelativeToBookmark(bookmark,rows); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OBookmarkSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::compareBookmarks" ); return m_xRowLocate->compareBookmarks(_first,_second); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OBookmarkSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::hasOrderedBookmarks" ); return m_xRowLocate->hasOrderedBookmarks(); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OBookmarkSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::hashBookmark" ); return m_xRowLocate->hashBookmark(bookmark); } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL OBookmarkSet::deleteRows( const Sequence< Any >& rows ,const connectivity::OSQLTable& /*_xTable*/) throw(SQLException, RuntimeException) { @@ -103,7 +102,7 @@ Sequence< sal_Int32 > SAL_CALL OBookmarkSet::deleteRows( const Sequence< Any >& } return Sequence< sal_Int32 >(); } -// ------------------------------------------------------------------------- + void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::insertRow" ); @@ -128,11 +127,10 @@ void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const conne else ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XRESULTSETUPDATE ), SQL_GENERAL_ERROR, *this ); } -// ------------------------------------------------------------------------- + void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::updateRow" ); - // OCacheSet::updateRow( _rInsertRow,_rOrginalRow,_xTable); Reference<XRowUpdate> xUpdRow(m_xRowLocate,UNO_QUERY); if(!xUpdRow.is()) ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XROWUPDATE ), SQL_GENERAL_ERROR, *this ); @@ -153,7 +151,7 @@ void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowS else ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XRESULTSETUPDATE ), SQL_GENERAL_ERROR, *this ); } -// ------------------------------------------------------------------------- + void SAL_CALL OBookmarkSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::deleteRow" ); @@ -161,12 +159,12 @@ void SAL_CALL OBookmarkSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const c xUpd->deleteRow(); } -// ------------------------------------------------------------------------- + void SAL_CALL OBookmarkSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::cancelRowUpdates" ); } -// ------------------------------------------------------------------------- + void SAL_CALL OBookmarkSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveToInsertRow" ); @@ -174,18 +172,18 @@ void SAL_CALL OBookmarkSet::moveToInsertRow( ) throw(SQLException, RuntimeExcep if(xUpd.is()) xUpd->moveToInsertRow(); } -// ------------------------------------------------------------------------- + void SAL_CALL OBookmarkSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::moveToCurrentRow" ); } -// ------------------------------------------------------------------------- + void OBookmarkSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::fillValueRow" ); OCacheSet::fillValueRow(_rRow,_nPosition); } -// ------------------------------------------------------------------------- + void OBookmarkSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xParameter,const ORowSetValue& _rValue) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::updateColumn" ); @@ -204,8 +202,6 @@ void OBookmarkSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xParamet break; case DataType::CHAR: case DataType::VARCHAR: - //case DataType::DECIMAL: - //case DataType::NUMERIC: _xParameter->updateString(nPos,_rValue); break; case DataType::BIGINT: @@ -265,4 +261,4 @@ void OBookmarkSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xParamet } } } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx index e1b6566ef..1b7b8052c 100644 --- a/dbaccess/source/core/api/BookmarkSet.hxx +++ b/dbaccess/source/core/api/BookmarkSet.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,12 +29,8 @@ #ifndef DBACCESS_CORE_API_BOOKMARKSET_HXX #define DBACCESS_CORE_API_BOOKMARKSET_HXX -#ifndef DBACCESS_CORE_API_CACHESET_HXX #include "CacheSet.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ #include <com/sun/star/sdbc/XRowUpdate.hpp> -#endif namespace dbaccess { @@ -73,3 +70,4 @@ namespace dbaccess } #endif // DBACCESS_CORE_API_BOOKMARKSET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CIndexColumn.hxx b/dbaccess/source/core/api/CIndexColumn.hxx index 81a3302b3..3bd08da3d 100644 --- a/dbaccess/source/core/api/CIndexColumn.hxx +++ b/dbaccess/source/core/api/CIndexColumn.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,9 +29,7 @@ #ifndef DBACCESS_INDEXCOLUMN_HXX_ #define DBACCESS_INDEXCOLUMN_HXX_ -#ifndef _CONNECTIVITY_ADABAS_COLUMN_HXX_ #include "adabas/BColumn.hxx" -#endif namespace connectivity { @@ -57,3 +56,5 @@ namespace connectivity } } #endif // DBACCESS_INDEXCOLUMN_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CIndexes.cxx b/dbaccess/source/core/api/CIndexes.cxx index f24a358ca..8ea223cff 100644 --- a/dbaccess/source/core/api/CIndexes.cxx +++ b/dbaccess/source/core/api/CIndexes.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,30 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_INDEXES_HXX_ #include "CIndexes.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ #include <com/sun/star/sdbc/XResultSet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ #include <com/sun/star/sdbc/IndexType.hpp> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif using namespace connectivity; @@ -75,7 +60,7 @@ ObjectType OIndexes::createObject(const ::rtl::OUString& _rName) return xRet; } -// ------------------------------------------------------------------------- + Reference< XPropertySet > OIndexes::createDescriptor() { Reference<XDataDescriptorFactory> xData( m_xIndexes,UNO_QUERY); @@ -84,7 +69,7 @@ Reference< XPropertySet > OIndexes::createDescriptor() else return OIndexesHelper::createDescriptor(); } -// ------------------------------------------------------------------------- + // XAppend ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { @@ -95,7 +80,7 @@ ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Refer xData->appendByDescriptor(descriptor); return createObject( _rForName ); } -// ------------------------------------------------------------------------- + // XDrop void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { @@ -108,7 +93,7 @@ void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) else OIndexesHelper::dropObject(_nPos,_sElementName); } -// ------------------------------------------------------------------------- + void SAL_CALL OIndexes::disposing(void) { if ( m_xIndexes.is() ) @@ -116,8 +101,4 @@ void SAL_CALL OIndexes::disposing(void) else OIndexesHelper::disposing(); } -// ----------------------------------------------------------------------------- - - - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CIndexes.hxx b/dbaccess/source/core/api/CIndexes.hxx index 784e2ba80..ec58d93f9 100644 --- a/dbaccess/source/core/api/CIndexes.hxx +++ b/dbaccess/source/core/api/CIndexes.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,9 +29,7 @@ #ifndef DBACCESS_INDEXES_HXX_ #define DBACCESS_INDEXES_HXX_ -#ifndef CONNECTIVITY_INDEXESHELPER_HXX #include "connectivity/TIndexes.hxx" -#endif namespace dbaccess { @@ -56,3 +55,5 @@ namespace dbaccess } #endif // DBACCESS_INDEXES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CRowSetColumn.cxx b/dbaccess/source/core/api/CRowSetColumn.cxx index 60c4fe1d4..444169cf9 100644 --- a/dbaccess/source/core/api/CRowSetColumn.cxx +++ b/dbaccess/source/core/api/CRowSetColumn.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,32 +44,25 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; -//.............................................................................. namespace dbaccess { -//.............................................................................. -//------------------------------------------------------------------------------ ORowSetColumn::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 ) :ORowSetDataColumn( _xMetaData, _xRow, NULL, _nPos, _rxDBMeta, _rDescription, i_sLabel,_rColumnValue ) { } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const { - const sal_Int32 nDerivedProperties = 21; - Sequence< Property> aDerivedProperties( nDerivedProperties ); - Property* pDesc = aDerivedProperties.getArray(); - sal_Int32 nPos = 0; + BEGIN_PROPERTY_SEQUENCE(21) DECL_PROP1( CATALOGNAME, ::rtl::OUString, READONLY ); DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY ); DECL_PROP1_BOOL( ISAUTOINCREMENT, READONLY ); DECL_PROP1_BOOL( ISCASESENSITIVE, READONLY ); DECL_PROP1_BOOL( ISCURRENCY, READONLY ); - DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY ); + DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY ); DECL_PROP1( ISNULLABLE, sal_Int32, READONLY ); DECL_PROP1_BOOL( ISREADONLY, BOUND ); DECL_PROP1_BOOL( ISROWVERSION, READONLY ); @@ -84,21 +78,20 @@ ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData DECL_PROP1( TYPE, sal_Int32, READONLY ); DECL_PROP1( TYPENAME, ::rtl::OUString, READONLY ); DECL_PROP2( VALUE, Any, READONLY, BOUND ); - OSL_ENSURE( nPos == nDerivedProperties, "ORowSetColumn::createArrayHelper: inconsistency!" ); + + END_PROPERTY_SEQUENCE() Sequence< Property > aRegisteredProperties; describeProperties( aRegisteredProperties ); - return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDerivedProperties, aRegisteredProperties ), sal_False ); + return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDescriptor, aRegisteredProperties ), sal_False ); } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& ORowSetColumn::getInfoHelper() { return *static_cast< ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >* >(this)->getArrayHelper(); } -//------------------------------------------------------------------------------ void SAL_CALL ORowSetColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception) { OSL_ENSURE( nHandle != PROPERTY_ID_VALUE, "ORowSetColumn::setFastPropertyValue_NoBroadcast: hmm? This property is marked as READONLY!" ); @@ -106,6 +99,5 @@ void SAL_CALL ORowSetColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, ORowSetDataColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue ); } -//.............................................................................. } // namespace dbaccess -//.............................................................................. +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CRowSetColumn.hxx b/dbaccess/source/core/api/CRowSetColumn.hxx index 3b16166da..f2c84a3b2 100644 --- a/dbaccess/source/core/api/CRowSetColumn.hxx +++ b/dbaccess/source/core/api/CRowSetColumn.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,25 +28,17 @@ #ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX #define DBACCESS_CORE_API_CROWSETCOLUMN_HXX -#ifndef DBACCESS_CORE_API_ROWSETROW_HXX #include "RowSetRow.hxx" -#endif -#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #include <connectivity/CommonTools.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include <comphelper/proparrhlp.hxx> -#endif -#ifndef DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX #include "CRowSetDataColumn.hxx" -#endif namespace dbaccess { class ORowSetColumn; class ORowSetColumn :public ORowSetDataColumn ,public ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn > - + { public: ORowSetColumn( const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XResultSetMetaData >& _xMetaData, @@ -64,3 +57,5 @@ namespace dbaccess } #endif // DBACCESS_CORE_API_CROWSETCOLUMN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx index 502a0a631..9e6bfe87d 100644 --- a/dbaccess/source/core/api/CRowSetDataColumn.cxx +++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,34 +29,19 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBACORE_DATACOLUMN_HXX_ #include "CRowSetDataColumn.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif using namespace dbaccess; using namespace comphelper; using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -64,7 +50,7 @@ using namespace cppu; using namespace osl; DBG_NAME(ORowSetDataColumn) -// ------------------------------------------------------------------------- + ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >& _xMetaData, const Reference < XRow >& _xRow, const Reference < XRowUpdate >& _xRowUpdate, @@ -82,20 +68,16 @@ ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >& _x OColumnSettings::registerProperties( *this ); registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, PropertyAttribute::READONLY, &m_aDescription, ::getCppuType( &m_aDescription ) ); } -// ------------------------------------------------------------------------- + ORowSetDataColumn::~ORowSetDataColumn() { DBG_DTOR(ORowSetDataColumn,NULL); } -// ------------------------------------------------------------------------- + // comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* ORowSetDataColumn::createArrayHelper( ) const { - const sal_Int32 nDerivedProperties = 21; - Sequence< Property> aDerivedProperties( nDerivedProperties ); - Property* pDesc = aDerivedProperties.getArray(); - sal_Int32 nPos = 0; + BEGIN_PROPERTY_SEQUENCE(21) DECL_PROP1( CATALOGNAME, ::rtl::OUString, READONLY ); DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY ); @@ -118,26 +100,26 @@ ORowSetDataColumn::~ORowSetDataColumn() DECL_PROP1( TYPE, sal_Int32, READONLY ); DECL_PROP1( TYPENAME, ::rtl::OUString, READONLY ); DECL_PROP1( VALUE, Any, BOUND ); - OSL_ENSURE( nPos == nDerivedProperties, "ORowSetDataColumn::createArrayHelper: inconsistency!" ); + + END_PROPERTY_SEQUENCE() Sequence< Property > aRegisteredProperties; describeProperties( aRegisteredProperties ); - return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDerivedProperties, aRegisteredProperties ), sal_False ); + return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDescriptor, aRegisteredProperties ), sal_False ); } // cppu::OPropertySetHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& ORowSetDataColumn::getInfoHelper() { return *static_cast< ::comphelper::OPropertyArrayUsageHelper< ORowSetDataColumn >* >(this)->getArrayHelper(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSetDataColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { if ( PROPERTY_ID_VALUE == nHandle ) { - if ( !m_aColumnValue.isNull() && m_aColumnValue->isValid() ) + if ( !m_aColumnValue.isNull() && m_aColumnValue->is() ) { ::osl::Mutex* pMutex = m_aColumnValue.getMutex(); ::osl::MutexGuard aGuard( *pMutex ); @@ -154,7 +136,6 @@ void SAL_CALL ORowSetDataColumn::getFastPropertyValue( Any& rValue, sal_Int32 nH ODataColumn::getFastPropertyValue( rValue, nHandle ); } -// ------------------------------------------------------------------------- void SAL_CALL ORowSetDataColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception) { switch( nHandle ) @@ -174,7 +155,7 @@ void SAL_CALL ORowSetDataColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHan break; } } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetDataColumn::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, @@ -204,7 +185,7 @@ sal_Bool SAL_CALL ORowSetDataColumn::convertFastPropertyValue( Any & rConvertedV return bModified; } -//-------------------------------------------------------------------------- + Sequence< sal_Int8 > ORowSetDataColumn::getImplementationId() throw (RuntimeException) { static OImplementationId * pId = 0; @@ -219,10 +200,10 @@ Sequence< sal_Int8 > ORowSetDataColumn::getImplementationId() throw (RuntimeExce } return pId->getImplementationId(); } -// ------------------------------------------------------------------------- + void ORowSetDataColumn::fireValueChange(const ORowSetValue& _rOldValue) { - if ( !m_aColumnValue.isNull() && m_aColumnValue->isValid() && (!(((*m_aColumnValue)->get())[m_nPos] == _rOldValue)) ) + if ( !m_aColumnValue.isNull() && m_aColumnValue->is() && (!(((*m_aColumnValue)->get())[m_nPos] == _rOldValue)) ) { sal_Int32 nHandle = PROPERTY_ID_VALUE; m_aOldValue = _rOldValue.makeAny(); @@ -239,11 +220,11 @@ void ORowSetDataColumn::fireValueChange(const ORowSetValue& _rOldValue) fire(&nHandle, &aNew, &m_aOldValue, 1, sal_False ); } } -// ----------------------------------------------------------------------------- + DBG_NAME(ORowSetDataColumns ) ORowSetDataColumns::ORowSetDataColumns( sal_Bool _bCase, - const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns, + const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::std::vector< ::rtl::OUString> &_rVector @@ -252,12 +233,12 @@ ORowSetDataColumns::ORowSetDataColumns( { DBG_CTOR(ORowSetDataColumns ,NULL); } -// ----------------------------------------------------------------------------- + ORowSetDataColumns::~ORowSetDataColumns() { DBG_DTOR(ORowSetDataColumns ,NULL); } -// ----------------------------------------------------------------------------- + sdbcx::ObjectType ORowSetDataColumns::createObject(const ::rtl::OUString& _rName) { connectivity::sdbcx::ObjectType xNamed; @@ -269,24 +250,20 @@ sdbcx::ObjectType ORowSetDataColumns::createObject(const ::rtl::OUString& _rName return xNamed; } -// ----------------------------------------------------------------------------- + void SAL_CALL ORowSetDataColumns::disposing(void) { - // clear_NoDispose(); ORowSetDataColumns_BASE::disposing(); m_aColumns = NULL; - // m_aColumns.clear(); } -// ----------------------------------------------------------------------------- -void ORowSetDataColumns::assign(const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns,const ::std::vector< ::rtl::OUString> &_rVector) + +void ORowSetDataColumns::assign(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,const ::std::vector< ::rtl::OUString> &_rVector) { m_aColumns = _rColumns; reFill(_rVector); } -// ----------------------------------------------------------------------------- + void ORowSetDataColumns::impl_refresh() throw(::com::sun::star::uno::RuntimeException) { } -// ----------------------------------------------------------------------------- - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx index 90677d117..477328ef8 100644 --- a/dbaccess/source/core/api/CRowSetDataColumn.hxx +++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -63,7 +64,7 @@ namespace dbaccess const ::rtl::OUString& i_sLabel, const ORowSetCacheIterator& _rColumnValue); - + // com::sun::star::lang::XTypeProvider virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); // comphelper::OPropertyArrayUsageHelper @@ -83,21 +84,18 @@ namespace dbaccess protected: using ODataColumn::getFastPropertyValue; }; - // ------------------------------------------------------------------------- -// typedef connectivity::ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> > -// ORowSetDataColumns_COLLECTION; typedef connectivity::sdbcx::OCollection ORowSetDataColumns_BASE; class ORowSetDataColumns : public ORowSetDataColumns_BASE { - ::vos::ORef< ::connectivity::OSQLColumns> m_aColumns; + ::rtl::Reference< ::connectivity::OSQLColumns> m_aColumns; protected: virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); public: ORowSetDataColumns( sal_Bool _bCase, - const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns, + const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::std::vector< ::rtl::OUString> &_rVector @@ -105,9 +103,10 @@ namespace dbaccess virtual ~ORowSetDataColumns(); // only the name is identical to ::cppu::OComponentHelper virtual void SAL_CALL disposing(void); - void assign(const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns,const ::std::vector< ::rtl::OUString> &_rVector); + void assign(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,const ::std::vector< ::rtl::OUString> &_rVector); }; } #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index 19a3bdd29..39121e0c2 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,64 +28,28 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_CORE_API_CACHESET_HXX #include "CacheSet.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ #include <com/sun/star/sdbcx/CompareBookmark.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> -#endif #include <com/sun/star/sdbc/ColumnValue.hpp> -#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ #include <com/sun/star/sdbc/XParameters.hpp> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XKeysSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XIndexesSupplier.hpp> -#endif #include <limits> -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ #include <com/sun/star/sdbcx/KeyType.hpp> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ #include <com/sun/star/io/XInputStream.hpp> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif #include <rtl/ustrbuf.hxx> #include <rtl/logfile.hxx> @@ -96,17 +61,15 @@ using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; -// using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::io; -// using namespace ::cppu; using namespace ::osl; DBG_NAME(OCacheSet) -// ------------------------------------------------------------------------- -OCacheSet::OCacheSet(sal_Int32 i_nMaxRows) + +OCacheSet::OCacheSet(sal_Int32 i_nMaxRows) :m_nMaxRows(i_nMaxRows) ,m_bInserted(sal_False) ,m_bUpdated(sal_False) @@ -116,7 +79,7 @@ OCacheSet::OCacheSet(sal_Int32 i_nMaxRows) DBG_CTOR(OCacheSet,NULL); } -// ------------------------------------------------------------------------- + ::rtl::OUString OCacheSet::getIdentifierQuoteString() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getIdentifierQuoteString" ); @@ -126,8 +89,8 @@ OCacheSet::OCacheSet(sal_Int32 i_nMaxRows) sQuote = xMeta->getIdentifierQuoteString(); return sQuote; } -// ------------------------------------------------------------------------- -void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& /*i_sRowSetFilter*/) + +void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& /*i_sRowSetFilter*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::construct" ); OSL_ENSURE(_xDriverSet.is(),"Invalid resultSet"); @@ -163,28 +126,28 @@ void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const ::rtl } } } -// ------------------------------------------------------------------------- + OCacheSet::~OCacheSet() { try { - m_xDriverSet = NULL; - m_xDriverRow = NULL; + m_xDriverSet = NULL; + m_xDriverRow = NULL; m_xSetMetaData = NULL; - m_xConnection = NULL; + m_xConnection = NULL; } catch(Exception&) { - OSL_ENSURE(0,"Exception occured"); + OSL_FAIL("Exception occurred"); } catch(...) { - OSL_ENSURE(0,"Unknown Exception occured"); + OSL_FAIL("Unknown Exception occurred"); } DBG_DTOR(OCacheSet,NULL); } -// ----------------------------------------------------------------------------- + void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillTableName" ); @@ -200,7 +163,7 @@ void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQL ,::dbtools::eInDataManipulation); } } -// ------------------------------------------------------------------------- + void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::insertRow" ); @@ -209,9 +172,9 @@ void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connecti fillTableName(xSet); aSql.append(m_aComposedTableName); - aSql.append(::rtl::OUString::createFromAscii(" ( ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ( "))); // set values and column names - ::rtl::OUStringBuffer aValues = ::rtl::OUString::createFromAscii(" VALUES ( "); + ::rtl::OUStringBuffer aValues = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" VALUES ( ")); static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM("?,")); ::rtl::OUString aQuote = getIdentifierQuoteString(); static ::rtl::OUString aComma(RTL_CONSTASCII_USTRINGPARAM(",")); @@ -244,33 +207,18 @@ void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connecti m_bInserted = xPrep->executeUpdate() > 0; } - -// ::rtl::OUString aCountSql = ::rtl::OUString::createFromAscii("SELECT COUNT(*) FROM "); -// aCountSql += m_aComposedTableName; -// try -// { -// Reference< XStatement > xStmt(m_xConnection->createStatement()); -// Reference<XResultSet> xRes(xStmt->executeQuery(aCountSql)); -// if(xRes.is() && xRes->next()) -// { -// Reference<XRow> xRow(xRes,UNO_QUERY); -// } -// } -// catch(SQLException&) -// { -// } - + // TODO set the bookmark in the insert row } -// ------------------------------------------------------------------------- + void OCacheSet::fillParameters( const ORowSetRow& _rRow - ,const connectivity::OSQLTable& _xTable + ,const connectivity::OSQLTable& _xTable ,::rtl::OUStringBuffer& _sCondition ,::rtl::OUStringBuffer& _sParameter ,::std::list< sal_Int32>& _rOrgValues) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillParameters" ); - // use keys and indexes for excat postioning + // use keys and indexes for exact positioning // first the keys Reference<XPropertySet> xSet(_xTable,UNO_QUERY); const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet); @@ -298,15 +246,15 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow } ::rtl::OUString aColumnName; - - static ::rtl::OUString aPara = ::rtl::OUString::createFromAscii("?,"); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + + static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM("?,")); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); ::rtl::OUString aQuote = getIdentifierQuoteString(); sal_Int32 nCheckCount = 1; // index for the orginal values sal_Int32 i = 1; - + ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")); ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rRow->get().begin()+1; @@ -324,7 +272,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow _sCondition.append(aAnd); _rOrgValues.push_back(nCheckCount); - } // if(xPrimaryKeyColumns.is() && xPrimaryKeyColumns->hasByName(aColumnName)) + } ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end(); for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin(); aIndexIter != aIndexEnd;++aIndexIter) @@ -348,18 +296,18 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow } } } -// ------------------------------------------------------------------------- + void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::updateRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); - ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("UPDATE "); + ::rtl::OUStringBuffer aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE ")); aSql.append(m_aComposedTableName); - aSql.append(::rtl::OUString::createFromAscii(" SET ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" SET "))); // list all cloumns that should be set - + ::rtl::OUStringBuffer aCondition; ::std::list< sal_Int32> aOrgValues; fillParameters(_rInsertRow,_xTable,aCondition,aSql,aOrgValues); @@ -368,7 +316,7 @@ void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetR { aCondition.setLength(aCondition.getLength()-5); - aSql.append(::rtl::OUString::createFromAscii(" WHERE ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "))); aSql.append(aCondition.makeStringAndClear()); } else @@ -387,7 +335,7 @@ void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetR setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i)); ++i; } - } // for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter) + } ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end(); for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValueEnd;++aOrgValue,++i) { @@ -396,22 +344,22 @@ void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetR m_bUpdated = xPrep->executeUpdate() > 0; } -// ------------------------------------------------------------------------- + void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::deleteRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); - ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM "); + ::rtl::OUStringBuffer aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE FROM ")); aSql.append(m_aComposedTableName); - aSql.append(::rtl::OUString::createFromAscii(" WHERE ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "))); // list all cloumns that should be set ::rtl::OUString aQuote = getIdentifierQuoteString(); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); - // use keys and indexes for excat postioning + // use keys and indexes for exact positioning // first the keys const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet); // second the indexes @@ -440,10 +388,10 @@ void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connecti ::rtl::OUStringBuffer aColumnName; ::std::list< sal_Int32> aOrgValues; fillParameters(_rDeleteRow,_xTable,aSql,aColumnName,aOrgValues); - + aSql.setLength(aSql.getLength()-5); - // now create end execute the prepared statement + // now create and execute the prepared statement Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear())); Reference< XParameters > xParameter(xPrep,UNO_QUERY); sal_Int32 i = 1; @@ -455,7 +403,7 @@ void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connecti m_bDeleted = xPrep->executeUpdate() > 0; } -// ------------------------------------------------------------------------- + void OCacheSet::setParameter(sal_Int32 nPos ,const Reference< XParameters >& _xParameter ,const ORowSetValue& _rValue @@ -466,7 +414,7 @@ void OCacheSet::setParameter(sal_Int32 nPos sal_Int32 nType = ( _nType != DataType::OTHER ) ? _nType : _rValue.getTypeKind(); ::dbtools::setObjectWithInfo(_xParameter,nPos,_rValue,nType,_nScale); } -// ------------------------------------------------------------------------- + void OCacheSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillValueRow" ); @@ -484,127 +432,127 @@ void OCacheSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition) aIter->fill(i,m_aColumnTypes[i-1],m_aNullable[i-1],this); } } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::wasNull( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::wasNull" ); return m_xDriverRow->wasNull(); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OCacheSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getString" ); return m_xDriverRow->getString(columnIndex); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBoolean" ); return m_xDriverRow->getBoolean(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int8 SAL_CALL OCacheSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getByte" ); return m_xDriverRow->getByte(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int16 SAL_CALL OCacheSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getShort" ); return m_xDriverRow->getShort(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OCacheSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getInt" ); return m_xDriverRow->getInt(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int64 SAL_CALL OCacheSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getLong" ); return m_xDriverRow->getLong(columnIndex); } -// ------------------------------------------------------------------------- + float SAL_CALL OCacheSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getFloat" ); return m_xDriverRow->getFloat(columnIndex); } -// ------------------------------------------------------------------------- + double SAL_CALL OCacheSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getDouble" ); return m_xDriverRow->getDouble(columnIndex); } -// ------------------------------------------------------------------------- + Sequence< sal_Int8 > SAL_CALL OCacheSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBytes" ); return m_xDriverRow->getBytes(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Date SAL_CALL OCacheSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getDate" ); return m_xDriverRow->getDate(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Time SAL_CALL OCacheSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getTime" ); return m_xDriverRow->getTime(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::DateTime SAL_CALL OCacheSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getTimestamp" ); return m_xDriverRow->getTimestamp(columnIndex); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBinaryStream" ); return m_xDriverRow->getBinaryStream(columnIndex); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getCharacterStream" ); return m_xDriverRow->getCharacterStream(columnIndex); } -// ------------------------------------------------------------------------- + Any SAL_CALL OCacheSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getObject" ); return m_xDriverRow->getObject(columnIndex,typeMap); } -// ------------------------------------------------------------------------- + Reference< XRef > SAL_CALL OCacheSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getRef" ); return m_xDriverRow->getRef(columnIndex); } -// ------------------------------------------------------------------------- + Reference< XBlob > SAL_CALL OCacheSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getBlob" ); return m_xDriverRow->getBlob(columnIndex); } -// ------------------------------------------------------------------------- + Reference< XClob > SAL_CALL OCacheSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getClob" ); return m_xDriverRow->getClob(columnIndex); } -// ------------------------------------------------------------------------- + Reference< XArray > SAL_CALL OCacheSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getArray" ); return m_xDriverRow->getArray(columnIndex); } -// ------------------------------------------------------------------------- + // XResultSet sal_Bool SAL_CALL OCacheSet::next( ) throw(SQLException, RuntimeException) { @@ -612,157 +560,157 @@ sal_Bool SAL_CALL OCacheSet::next( ) throw(SQLException, RuntimeException) m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->next(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isBeforeFirst" ); return m_xDriverSet->isBeforeFirst(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::isAfterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isAfterLast" ); return m_xDriverSet->isAfterLast(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::isFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isFirst" ); return m_xDriverSet->isFirst(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::isLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::isLast" ); return m_xDriverSet->isLast(); } -// ------------------------------------------------------------------------- + void SAL_CALL OCacheSet::beforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::beforeFirst" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_xDriverSet->beforeFirst(); } -// ------------------------------------------------------------------------- + void SAL_CALL OCacheSet::afterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::afterLast" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_xDriverSet->afterLast(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::first( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::first" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->first(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::last( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::last" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->last(); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OCacheSet::getRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getRow" ); return m_xDriverSet->getRow(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::absolute" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->absolute(row); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::relative" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->relative(rows); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::previous" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return m_xDriverSet->previous(); } + sal_Bool OCacheSet::last_checked( sal_Bool /*i_bFetchRow*/) { return last(); } -// ------------------------------------------------------------------------- + sal_Bool OCacheSet::previous_checked( sal_Bool /*i_bFetchRow*/ ) { return previous(); } -// ------------------------------------------------------------------------- + sal_Bool OCacheSet::absolute_checked( sal_Int32 row,sal_Bool /*i_bFetchRow*/ ) { return absolute(row); } -// ------------------------------------------------------------------------- + void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::refreshRow" ); m_xDriverSet->refreshRow(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::rowUpdated( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowUpdated" ); return m_xDriverSet->rowUpdated(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::rowInserted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowInserted" ); return m_xDriverSet->rowInserted(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OCacheSet::rowDeleted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::rowDeleted" ); return m_xDriverSet->rowDeleted(); } -// ------------------------------------------------------------------------- + Reference< XInterface > SAL_CALL OCacheSet::getStatement( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::getStatement" ); return m_xDriverSet->getStatement(); } -// ----------------------------------------------------------------------------- + bool OCacheSet::isResultSetChanged() const { return false; } -// ----------------------------------------------------------------------------- + void OCacheSet::reset(const Reference< XResultSet>& /*_xDriverSet*/) { - OSL_ENSURE(0,"Illegal call!"); + OSL_FAIL("Illegal call!"); } -// ----------------------------------------------------------------------------- + void OCacheSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& /*io_aInsertRow*/,ORowSetValueVector::Vector& /*io_aRow*/,::std::vector<sal_Int32>& o_aChangedColumns) { o_aChangedColumns.push_back(i_nColumnIndex); } -// ----------------------------------------------------------------------------- + bool OCacheSet::columnValuesUpdated(ORowSetValueVector::Vector& /*io_aCachedRow*/,const ORowSetValueVector::Vector& /*io_aRow*/) { return false; } -// ----------------------------------------------------------------------------- + bool OCacheSet::updateColumnValues(const ORowSetValueVector::Vector& /*io_aCachedRow*/,ORowSetValueVector::Vector& /*io_aRow*/,const ::std::vector<sal_Int32>& /*i_aChangedColumns*/) { return true; } -// ----------------------------------------------------------------------------- + void OCacheSet::fillMissingValues(ORowSetValueVector::Vector& /*io_aRow*/) const { } -// ----------------------------------------------------------------------------- - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx index 626e64323..03f98cbc5 100644 --- a/dbaccess/source/core/api/CacheSet.hxx +++ b/dbaccess/source/core/api/CacheSet.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -77,7 +78,7 @@ namespace dbaccess ,sal_Int32 _nScale ) const; void fillParameters( const ORowSetRow& _rRow - ,const connectivity::OSQLTable& _xTable + ,const connectivity::OSQLTable& _xTable ,::rtl::OUStringBuffer& _sCondition ,::rtl::OUStringBuffer& _sParameter ,::std::list< sal_Int32>& _rOrgValues); @@ -85,7 +86,7 @@ namespace dbaccess ::rtl::OUString getIdentifierQuoteString() const; public: - + // late constructor virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition); @@ -160,3 +161,4 @@ namespace dbaccess } #endif //DBACCESS_CORE_API_CACHESET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index e71ddf79b..fdee0412e 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -56,12 +57,11 @@ namespace dbaccess using namespace ::cppu; using namespace ::connectivity::sdbcx; -//------------------------------------------------------------------------------ /** creates a vector of WildCards and reduce the _rTableFilter of the length of WildsCards */ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std::vector< WildCard >& _rOut) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OFilteredContainer::createWildCardVector" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OFilteredContainer::createWildCardVector" ); // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard // for them ::rtl::OUString* pTableFilters = _rTableFilter.getArray(); @@ -87,7 +87,6 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std return nShiftPos; } - // ------------------------------------------------------------------------- bool lcl_isElementAllowed( const ::rtl::OUString& _rName, const Sequence< ::rtl::OUString >& _rTableFilter, const ::std::vector< WildCard >& _rWCSearch ) @@ -110,7 +109,6 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std return bFilterMatch; } - //-------------------------------------------------------------------------- typedef ::boost::optional< ::rtl::OUString > OptionalString; struct TableInfo { @@ -137,7 +135,6 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std }; typedef ::std::vector< TableInfo > TableInfos; - //-------------------------------------------------------------------------- void lcl_ensureComposedName( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData ) { if ( !_metaData.is() ) @@ -154,7 +151,6 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std } } - //-------------------------------------------------------------------------- void lcl_ensureType( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer ) { if ( !!_io_tableInfo.sType ) @@ -178,7 +174,6 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std _io_tableInfo.sType = OptionalString( sTypeName ); } - //-------------------------------------------------------------------------- connectivity::TStringVector lcl_filter( const TableInfos& _unfilteredTables, const Sequence< ::rtl::OUString >& _tableFilter, const Sequence< ::rtl::OUString >& _tableTypeFilter, const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer ) @@ -194,7 +189,7 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std } else { - // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard + // for wildcard search : remove all table filters which are a wildcard expression and build a WildCard // for them ::std::vector< WildCard > aWildCardTableFilter; Sequence< ::rtl::OUString > aNonWildCardTableFilter = _tableFilter; @@ -256,7 +251,7 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std //========================================================================== //= OViewContainer //========================================================================== - OFilteredContainer::OFilteredContainer(::cppu::OWeakObject& _rParent, + OFilteredContainer::OFilteredContainer(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const Reference< XConnection >& _xCon, sal_Bool _bCase, @@ -269,9 +264,9 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std ,m_pRefreshListener(_pRefreshListener) ,m_nInAppend(_nInAppend) ,m_xConnection(_xCon) - { + { } - // ------------------------------------------------------------------------- + void OFilteredContainer::construct(const Reference< XNameAccess >& _rxMasterContainer, const Sequence< ::rtl::OUString >& _rTableFilter, const Sequence< ::rtl::OUString >& _rTableTypeFilter) @@ -288,7 +283,7 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std } m_xMasterContainer = _rxMasterContainer; - + if ( m_xMasterContainer.is() ) { addMasterContainerListener(); @@ -311,17 +306,16 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std construct( _rTableFilter, _rTableTypeFilter ); } } - //------------------------------------------------------------------------------ + void OFilteredContainer::construct(const Sequence< ::rtl::OUString >& _rTableFilter, const Sequence< ::rtl::OUString >& _rTableTypeFilter) { // build sorted versions of the filter sequences, so the visibility decision is faster Sequence< ::rtl::OUString > aTableFilter(_rTableFilter); - sal_Int32 nTableFilterLen = aTableFilter.getLength(); - // for wildcard search : remove all table filters which are a wildcard expression and build a WilCard + // for wildcard search : remove all table filters which are a wildcard expression and build a WildCard // for them ::std::vector< WildCard > aWCSearch; - nTableFilterLen = createWildCardVector(aTableFilter,aWCSearch); + createWildCardVector(aTableFilter,aWCSearch); try { @@ -367,7 +361,7 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std } } - static const ::rtl::OUString sAll = ::rtl::OUString::createFromAscii("%"); + static const ::rtl::OUString sAll(RTL_CONSTASCII_USTRINGPARAM("%")); Reference< XResultSet > xTables = m_xMetaData->getTables( Any(), sAll, sAll, aTableTypeFilter ); Reference< XRow > xCurrentRow( xTables, UNO_QUERY_THROW ); @@ -399,7 +393,6 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std m_bConstructed = sal_True; } - //------------------------------------------------------------------------------ void OFilteredContainer::disposing() { OCollection::disposing(); @@ -410,11 +403,10 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std m_xMasterContainer = NULL; m_xMetaData = NULL; m_pWarningsContainer = NULL; - m_pRefreshListener = NULL; + m_pRefreshListener = NULL; m_bConstructed = sal_False; } - // ------------------------------------------------------------------------- void OFilteredContainer::impl_refresh() throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OFilteredContainer::impl_refresh" ); @@ -428,14 +420,12 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std } } - // ----------------------------------------------------------------------------- ::rtl::OUString OFilteredContainer::getNameForObject(const ObjectType& _xObject) { OSL_ENSURE( _xObject.is(), "OFilteredContainer::getNameForObject: Object is NULL!" ); return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::eInDataManipulation, false, false, false ); } - // ----------------------------------------------------------------------------- // multiple to obtain all tables from XDatabaseMetaData::getTables, via passing a particular // table type filter: // adhere to the standard, which requests to pass a NULL table type filter, if @@ -469,7 +459,7 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std switch ( nFilterMode ) { default: - OSL_ENSURE( sal_False, "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" ); + OSL_FAIL( "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" ); case FILTER_MODE_MIX_ALL: _rFilter.realloc( 3 ); _rFilter[0] = sView; @@ -491,8 +481,5 @@ sal_Int32 createWildCardVector(Sequence< ::rtl::OUString >& _rTableFilter, ::std } } -// .............................................................................. } // namespace -// .............................................................................. - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/HelperCollections.cxx b/dbaccess/source/core/api/HelperCollections.cxx index 85dbc2892..acc2d3ef3 100644 --- a/dbaccess/source/core/api/HelperCollections.cxx +++ b/dbaccess/source/core/api/HelperCollections.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,13 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBA_HELPERCOLLECTIONS_HXX #include "HelperCollections.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif namespace dbaccess { @@ -50,8 +47,8 @@ namespace dbaccess using namespace ::com::sun::star::script; using namespace ::cppu; using namespace ::osl; - // ----------------------------------------------------------------------------- - OPrivateColumns::OPrivateColumns(const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns, + + OPrivateColumns::OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns, sal_Bool _bCase, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -62,8 +59,7 @@ namespace dbaccess { } - // ------------------------------------------------------------------------- - OPrivateColumns* OPrivateColumns::createWithIntrinsicNames( const ::vos::ORef< ::connectivity::OSQLColumns >& _rColumns, + OPrivateColumns* OPrivateColumns::createWithIntrinsicNames( const ::rtl::Reference< ::connectivity::OSQLColumns >& _rColumns, sal_Bool _bCase, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex ) { ::std::vector< ::rtl::OUString > aNames; aNames.reserve( _rColumns->get().size() ); @@ -81,7 +77,6 @@ namespace dbaccess return new OPrivateColumns( _rColumns, _bCase, _rParent, _rMutex, aNames, sal_False ); } - // ------------------------------------------------------------------------- void SAL_CALL OPrivateColumns::disposing(void) { m_aColumns = NULL; @@ -90,10 +85,10 @@ namespace dbaccess // So we're not allowed to dispose our elements. OPrivateColumns_Base::disposing(); } - // ------------------------------------------------------------------------- + connectivity::sdbcx::ObjectType OPrivateColumns::createObject(const ::rtl::OUString& _rName) { - if ( m_aColumns.isValid() ) + if ( m_aColumns.is() ) { ::connectivity::OSQLColumns::Vector::const_iterator aIter = find(m_aColumns->get().begin(),m_aColumns->get().end(),_rName,isCaseSensitive()); if(aIter == m_aColumns->get().end()) @@ -102,11 +97,11 @@ namespace dbaccess if(aIter != m_aColumns->get().end()) return connectivity::sdbcx::ObjectType(*aIter,UNO_QUERY); - OSL_ENSURE(0,"Column not found in collection!"); + OSL_FAIL("Column not found in collection!"); } return NULL; } - // ------------------------------------------------------------------------- + connectivity::sdbcx::ObjectType OPrivateTables::createObject(const ::rtl::OUString& _rName) { if ( !m_aTables.empty() ) @@ -114,9 +109,11 @@ namespace dbaccess OSQLTables::iterator aIter = m_aTables.find(_rName); OSL_ENSURE(aIter != m_aTables.end(),"Table not found!"); OSL_ENSURE(aIter->second.is(),"Table is null!"); + (void)aIter; return connectivity::sdbcx::ObjectType(m_aTables.find(_rName)->second,UNO_QUERY); } return NULL; } - // ----------------------------------------------------------------------------- } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/HelperCollections.hxx b/dbaccess/source/core/api/HelperCollections.hxx index 049f2c000..ec24c9cba 100644 --- a/dbaccess/source/core/api/HelperCollections.hxx +++ b/dbaccess/source/core/api/HelperCollections.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,21 +28,11 @@ #ifndef DBA_HELPERCOLLECTIONS_HXX #define DBA_HELPERCOLLECTIONS_HXX -#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include "connectivity/sdbcx/VCollection.hxx" -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _DBHELPER_DBCONVERSION_HXX_ #include <connectivity/dbconversion.hxx> -#endif -#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include <connectivity/PColumn.hxx> -#endif -#ifndef _VOS_REF_HXX_ -#include <vos/ref.hxx> -#endif +#include <rtl/ref.hxx> namespace dbaccess { @@ -58,11 +49,11 @@ namespace dbaccess using namespace ::com::sun::star::script; using namespace ::cppu; using namespace ::osl; - // ----------------------------------------------------------------------------- + typedef connectivity::sdbcx::OCollection OPrivateColumns_Base; class OPrivateColumns : public OPrivateColumns_Base { - ::vos::ORef< ::connectivity::OSQLColumns> m_aColumns; + ::rtl::Reference< ::connectivity::OSQLColumns> m_aColumns; protected: virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); virtual void impl_refresh() throw(RuntimeException) {} @@ -71,7 +62,7 @@ namespace dbaccess return NULL; } public: - OPrivateColumns(const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns, + OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns, sal_Bool _bCase, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, @@ -82,7 +73,7 @@ namespace dbaccess /** creates a columns instance as above, but taking the names from the columns itself */ static OPrivateColumns* createWithIntrinsicNames( - const ::vos::ORef< ::connectivity::OSQLColumns >& _rColumns, + const ::rtl::Reference< ::connectivity::OSQLColumns >& _rColumns, sal_Bool _bCase, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex @@ -126,3 +117,5 @@ namespace dbaccess }; } #endif // DBA_HELPERCOLLECTIONS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 8420c5e22..eda1e4231 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle andor its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,85 +29,35 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_CORE_API_KEYSET_HXX #include "KeySet.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#endif #include <com/sun/star/sdbc/ColumnValue.hpp> -#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCxParameterS_HPP_ #include <com/sun/star/sdbc/XParameters.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XGENERATEDRESULTSET_HPP_ #include <com/sun/star/sdbc/XGeneratedResultSet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ #include <com/sun/star/sdbc/XColumnLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ #include <com/sun/star/container/XIndexAccess.hpp> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XKeysSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_ #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XIndexesSupplier.hpp> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ #include <com/sun/star/sdbcx/KeyType.hpp> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif #include <list> #include <algorithm> #include <string.h> -#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ #include <com/sun/star/io/XInputStream.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX #include "querycomposer.hxx" -#endif -#ifndef DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX #include "composertools.hxx" -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif #include <string.h> #include <rtl/logfile.hxx> #include "PrivateRow.hxx" @@ -148,7 +99,7 @@ namespace } } DBG_NAME(OKeySet) -// ------------------------------------------------------------------------- + OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, const Reference< XIndexAccess>& _xTableKeys, const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name @@ -173,20 +124,20 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, DBG_CTOR(OKeySet,NULL); } -// ----------------------------------------------------------------------------- + OKeySet::~OKeySet() { try { ::comphelper::disposeComponent(m_xStatement); } - catch(Exception&) + catch(const Exception&) { m_xStatement = NULL; } catch(...) { - OSL_ENSURE(0,"Unknown Exception occured"); + OSL_FAIL("Unknown Exception occurred"); } m_xComposer = NULL; @@ -229,7 +180,7 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable, ::rtl::OUString sUpdateTableName( i_rUpdateTableName ); if ( sUpdateTableName.getLength() == 0 ) { - OSL_ENSURE( false, "OKeySet::findTableColumnsMatching_throw: This is a fallback only - it won't work when the table has an alias name." ); + OSL_FAIL( "OKeySet::findTableColumnsMatching_throw: This is a fallback only - it won't work when the table has an alias name." ); // If i_aTable originates from a query composer, and is a table which appears with an alias in the SELECT statement, // then the below code will not produce correct results. // For instance, imagine a "SELECT alias.col FROM table AS alias". Now i_aTable would be the table named @@ -272,7 +223,7 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable, } ::rtl::OUStringBuffer OKeySet::createKeyFilter() { - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); const ::rtl::OUString aQuote = getIdentifierQuoteString(); ::rtl::OUStringBuffer aFilter; static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM(".")); @@ -292,13 +243,13 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable, } return aFilter; } -// ----------------------------------------------------------------------------- + void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::construct" ); OCacheSet::construct(_xDriverSet,i_sRowSetFilter); initColumns(); - + Reference<XNameAccess> xKeyColumns = getKeyColumns(); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY); @@ -321,7 +272,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O const Sequence< ::rtl::OUString> aSeq = xSelectTables->getElementNames(); if ( aSeq.getLength() > 1 ) // special handling for join { - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); const ::rtl::OUString aQuote = getIdentifierQuoteString(); static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM(".")); static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); @@ -334,27 +285,24 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O connectivity::OSQLTable xSelColSup(xSelectTables->getByName(*pIter),uno::UNO_QUERY); Reference<XPropertySet> xProp(xSelColSup,uno::UNO_QUERY); ::rtl::OUString sSelectTableName = ::dbtools::composeTableName( xMeta, xProp, ::dbtools::eInDataManipulation, false, false, false ); - - ::dbaccess::getColumnPositions(xQueryColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames)); - + + ::dbaccess::getColumnPositions(xQueryColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames)); + SelectColumnsMetaData::iterator aPosEnd = (*m_pForeignColumnNames).end(); for(SelectColumnsMetaData::iterator aPosIter = (*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter) { // look for columns not in the source columns to use them as filter as well - // if ( !xSourceColumns->hasByName(aPosIter->first) ) - { if ( aFilter.getLength() ) aFilter.append(aAnd); aFilter.append(::dbtools::quoteName( aQuote,sSelectTableName)); aFilter.append(s_sDot); aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sRealName)); aFilter.append(s_sParam); - } } break; } } - } // if ( aSeq.getLength() > 1 ) // special handling for join + } executeStatement(aFilter,i_sRowSetFilter,xAnalyzer); } void OKeySet::executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OUString& i_sRowSetFilter,Reference<XSingleSelectQueryComposer>& io_xAnalyzer) @@ -380,7 +328,7 @@ void OKeySet::executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OU for(;pAnd != pAndEnd;++pAnd) { ::rtl::OUString sValue; - if ( !(pAnd->Value >>= sValue) || !(sValue.equalsAscii("?") || sValue.matchAsciiL(":",1,0)) ) + if ( !(pAnd->Value >>= sValue) || !(sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("?")) || sValue.matchAsciiL(":",1,0)) ) { // we have a criteria which has to be taken into account for updates m_aFilterColumns.push_back(pAnd->Name); } @@ -390,7 +338,7 @@ void OKeySet::executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OU m_xStatement = m_xConnection->prepareStatement(io_xAnalyzer->getQueryWithSubstitution()); ::comphelper::disposeComponent(io_xAnalyzer); } -// ------------------------------------------------------------------------- + Any SAL_CALL OKeySet::getBookmark() throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBookmark" ); @@ -399,7 +347,6 @@ Any SAL_CALL OKeySet::getBookmark() throw(SQLException, RuntimeException) return makeAny(m_aKeyIter->first); } -// ------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveToBookmark" ); @@ -407,7 +354,7 @@ sal_Bool SAL_CALL OKeySet::moveToBookmark( const Any& bookmark ) throw(SQLExcept m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(bookmark)); return m_aKeyIter != m_aKeyMap.end(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveRelativeToBookmark" ); @@ -420,7 +367,7 @@ sal_Bool SAL_CALL OKeySet::moveRelativeToBookmark( const Any& bookmark, sal_Int3 return !isBeforeFirst() && !isAfterLast(); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OKeySet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::compareBookmarks" ); @@ -430,19 +377,19 @@ sal_Int32 SAL_CALL OKeySet::compareBookmarks( const Any& _first, const Any& _sec return (nFirst != nSecond) ? CompareBookmark::NOT_EQUAL : CompareBookmark::EQUAL; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::hasOrderedBookmarks" ); return sal_True; } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OKeySet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::hashBookmark" ); return ::comphelper::getINT32(bookmark); } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows ,const connectivity::OSQLTable& _xTable) throw(SQLException, RuntimeException) { @@ -450,22 +397,22 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); - ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM "); + ::rtl::OUStringBuffer aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE FROM ")); aSql.append(m_aComposedTableName); - aSql.append(::rtl::OUString::createFromAscii(" WHERE ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "))); // list all cloumns that should be set const ::rtl::OUString aQuote = getIdentifierQuoteString(); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); - static ::rtl::OUString aOr = ::rtl::OUString::createFromAscii(" OR "); - static ::rtl::OUString aEqual = ::rtl::OUString::createFromAscii(" = ?"); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); + static ::rtl::OUString aOr(RTL_CONSTASCII_USTRINGPARAM(" OR ")); + static ::rtl::OUString aEqual(RTL_CONSTASCII_USTRINGPARAM(" = ?")); // use keys and indexes for excat postioning // first the keys Reference<XNameAccess> xKeyColumns = getKeyColumns(); - ::rtl::OUStringBuffer aCondition = ::rtl::OUString::createFromAscii("( "); + ::rtl::OUStringBuffer aCondition = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("( ")); SelectColumnsMetaData::const_iterator aIter = (*m_pKeyColumnNames).begin(); SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end(); @@ -531,20 +478,20 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows } return aRet; } -// ------------------------------------------------------------------------- + void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::updateRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); - ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("UPDATE "); + ::rtl::OUStringBuffer aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE ")); aSql.append(m_aComposedTableName); - aSql.append(::rtl::OUString::createFromAscii(" SET ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" SET "))); // list all cloumns that should be set - static ::rtl::OUString aPara = ::rtl::OUString::createFromAscii(" = ?,"); + static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM(" = ?,")); ::rtl::OUString aQuote = getIdentifierQuoteString(); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")); ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); @@ -573,7 +520,6 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end(); for(;aIter != aEnd;++aIter,++i) { - //if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first)) if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() ) { sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName)); @@ -620,7 +566,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow if(sKeyCondition.getLength() || sIndexCondition.getLength()) { - aSql.append(::rtl::OUString::createFromAscii(" WHERE ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "))); if(sKeyCondition.getLength() && sIndexCondition.getLength()) { aSql.append(sKeyCondition.makeStringAndClear()); @@ -640,11 +586,10 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection ); // now create end execute the prepared statement - ::rtl::OUString sEmpty; executeUpdate(_rInsertRow ,_rOrginalRow,aSql.makeStringAndClear(),sEmpty,aIndexColumnPositions); } -// ----------------------------------------------------------------------------- + void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,const ::std::vector<sal_Int32>& _aIndexColumnPositions) { // now create end execute the prepared statement @@ -710,16 +655,16 @@ void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rO tryRefetch(_rInsertRow,bRefetch); } } -// ------------------------------------------------------------------------- + void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::insertRow" ); - ::rtl::OUStringBuffer aSql(::rtl::OUString::createFromAscii("INSERT INTO ")); + ::rtl::OUStringBuffer aSql(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT INTO "))); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); aSql.append(m_aComposedTableName); - aSql.append(::rtl::OUString::createFromAscii(" ( ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ( "))); // set values and column names ::rtl::OUStringBuffer aValues(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" VALUES ( "))); static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM("?,")); @@ -755,7 +700,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi ::rtl::OUString sEmpty; executeInsert(_rInsertRow,aSql.makeStringAndClear(),sEmpty,bRefetch); } -// ------------------------------------------------------------------------- + void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,bool bRefetch ) { // now create,fill and execute the prepared statement @@ -821,9 +766,9 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString } } } - catch(Exception&) + catch(const Exception&) { - OSL_ENSURE(0,"Could not execute GeneratedKeys() stmt"); + OSL_FAIL("Could not execute GeneratedKeys() stmt"); } } @@ -854,10 +799,10 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString if(sMaxStmt.getLength()) { - sMaxStmt = sMaxStmt.replaceAt(sMaxStmt.getLength()-1,1,::rtl::OUString::createFromAscii(" ")); - ::rtl::OUString sStmt = ::rtl::OUString::createFromAscii("SELECT "); + sMaxStmt = sMaxStmt.replaceAt(sMaxStmt.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "))); + ::rtl::OUString sStmt = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT ")); sStmt += sMaxStmt; - sStmt += ::rtl::OUString::createFromAscii("FROM "); + sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FROM ")); ::rtl::OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); sStmt += ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ); @@ -882,7 +827,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString } catch(SQLException&) { - OSL_ENSURE(0,"Could not fetch with MAX() "); + OSL_FAIL("Could not fetch with MAX() "); } } } @@ -892,7 +837,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString --aKeyIter; ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size()); copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1); - + m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first + 1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(1,NULL)))).first; // now we set the bookmark for this row (_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first); @@ -915,7 +860,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch) connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd; OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first); if ( aUpdateFind == m_aUpdatedParameter.end() ) - { + { aParaIter = m_aParameterValueForCache.get().begin(); aParaEnd = m_aParameterValueForCache.get().end(); } @@ -924,7 +869,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch) aParaIter = aUpdateFind->second.get().begin(); aParaEnd = aUpdateFind->second.get().end(); } - + for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos) { ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() ); @@ -943,7 +888,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch) OSL_ENSURE(m_xSet.is(),"No resultset form statement!"); bRefetch = m_xSet->next(); } - catch(Exception) + catch(const Exception&) { bRefetch = false; } @@ -953,7 +898,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch) m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get()); } } -// ----------------------------------------------------------------------------- + void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::copyRowValue" ); @@ -993,20 +938,20 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sa aIter->setTypeKind(aPosIter->second.nType); } } -// ------------------------------------------------------------------------- + void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::deleteRow" ); Reference<XPropertySet> xSet(_xTable,UNO_QUERY); fillTableName(xSet); - ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM "); + ::rtl::OUStringBuffer aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE FROM ")); aSql.append(m_aComposedTableName); - aSql.append(::rtl::OUString::createFromAscii(" WHERE ")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "))); // list all cloumns that should be set ::rtl::OUString aQuote = getIdentifierQuoteString(); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); // use keys and indexes for excat postioning Reference<XNameAccess> xKeyColumns = getKeyColumns(); @@ -1034,11 +979,11 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit aSql.append(::dbtools::quoteName( aQuote,aIter->second.sRealName)); if((_rDeleteRow->get())[aIter->second.nPosition].isNull()) { - OSL_ENSURE(0,"can a primary key be null"); - aSql.append(::rtl::OUString::createFromAscii(" IS NULL")); + OSL_FAIL("can a primary key be null"); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL"))); } else - aSql.append(::rtl::OUString::createFromAscii(" = ?")); + aSql.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = ?"))); aSql.append(aAnd); } else @@ -1051,10 +996,10 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit { sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName)); if((_rDeleteRow->get())[aIter->second.nPosition].isNull()) - sIndexCondition.append(::rtl::OUString::createFromAscii(" IS NULL")); + sIndexCondition.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL"))); else { - sIndexCondition.append(::rtl::OUString::createFromAscii(" = ?")); + sIndexCondition.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = ?"))); aIndexColumnPositions.push_back(aIter->second.nPosition); } sIndexCondition.append(aAnd); @@ -1099,29 +1044,29 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit m_bDeleted = sal_True; } } -// ------------------------------------------------------------------------- + void SAL_CALL OKeySet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::cancelRowUpdates" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; } -// ------------------------------------------------------------------------- + void SAL_CALL OKeySet::moveToInsertRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveToInsertRow" ); } -// ------------------------------------------------------------------------- + void SAL_CALL OKeySet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::moveToCurrentRow" ); } -// ------------------------------------------------------------------------- + Reference<XNameAccess> OKeySet::getKeyColumns() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getKeyColumns" ); // use keys and indexes for excat postioning // first the keys - + Reference<XIndexAccess> xKeys = m_xTableKeys; if ( !xKeys.is() ) { @@ -1156,7 +1101,7 @@ Reference<XNameAccess> OKeySet::getKeyColumns() const return xKeyColumns; } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::next" ); @@ -1182,19 +1127,19 @@ sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException) refreshRow(); return !isAfterLast(); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::isBeforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isBeforeFirst" ); return m_aKeyIter == m_aKeyMap.begin(); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::isAfterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isAfterLast" ); return m_bRowCountFinal && m_aKeyIter == m_aKeyMap.end(); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::isFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isFirst" ); @@ -1202,7 +1147,7 @@ sal_Bool SAL_CALL OKeySet::isFirst( ) throw(SQLException, RuntimeException) ++aTemp; return m_aKeyIter == aTemp && m_aKeyIter != m_aKeyMap.end(); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::isLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::isLast" ); @@ -1213,7 +1158,7 @@ sal_Bool SAL_CALL OKeySet::isLast( ) throw(SQLException, RuntimeException) --aTemp; return m_aKeyIter == aTemp; } -// ----------------------------------------------------------------------------- + void SAL_CALL OKeySet::beforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::beforeFirst" ); @@ -1222,7 +1167,7 @@ void SAL_CALL OKeySet::beforeFirst( ) throw(SQLException, RuntimeException) m_xRow = NULL; ::comphelper::disposeComponent(m_xSet); } -// ----------------------------------------------------------------------------- + void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::afterLast" ); @@ -1232,7 +1177,7 @@ void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException) m_xRow = NULL; ::comphelper::disposeComponent(m_xSet); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::first" ); @@ -1245,7 +1190,7 @@ sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException) refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::last( ) throw(SQLException, RuntimeException) { return last_checked(sal_True); @@ -1263,7 +1208,7 @@ sal_Bool OKeySet::last_checked( sal_Bool i_bFetchRow) refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } -// ----------------------------------------------------------------------------- + sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getRow" ); @@ -1272,7 +1217,7 @@ sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException) return ::std::distance(m_aKeyMap.begin(),m_aKeyIter); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { return absolute_checked(row,sal_True); @@ -1320,7 +1265,7 @@ sal_Bool OKeySet::absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ) return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::relative" ); @@ -1331,7 +1276,7 @@ sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, Runtim } return absolute(getRow()+rows); } -// ----------------------------------------------------------------------------- + sal_Bool OKeySet::previous_checked( sal_Bool i_bFetchRow ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::previous" ); @@ -1344,7 +1289,6 @@ sal_Bool OKeySet::previous_checked( sal_Bool i_bFetchRow ) } return m_aKeyIter != m_aKeyMap.begin(); } -// ----------------------------------------------------------------------------- sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException) { return previous_checked(sal_True); @@ -1375,7 +1319,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd; OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first); if ( aUpdateFind == m_aUpdatedParameter.end() ) - { + { aParaIter = m_aParameterValueForCache.get().begin(); aParaEnd = m_aParameterValueForCache.get().end(); } @@ -1384,7 +1328,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) aParaIter = aUpdateFind->second.get().begin(); aParaEnd = aUpdateFind->second.get().end(); } - + for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos) { ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() ); @@ -1418,7 +1362,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) OSL_ENSURE(m_xRow.is(),"No row form statement!"); } } -// ----------------------------------------------------------------------------- + sal_Bool OKeySet::fetchRow() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::fetchRow" ); @@ -1452,7 +1396,7 @@ sal_Bool OKeySet::fetchRow() m_bRowCountFinal = sal_True; return bRet; } -// ------------------------------------------------------------------------- + void OKeySet::fillAllRows() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::fillAllRows" ); @@ -1468,152 +1412,152 @@ sal_Bool SAL_CALL OKeySet::wasNull( ) throw(SQLException, RuntimeException) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::wasNull" ); return m_xRow->wasNull(); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OKeySet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getString" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getString(columnIndex); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBoolean" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBoolean(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int8 SAL_CALL OKeySet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getByte" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getByte(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int16 SAL_CALL OKeySet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getShort" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getShort(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OKeySet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getInt" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getInt(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int64 SAL_CALL OKeySet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getLong" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getLong(columnIndex); } -// ------------------------------------------------------------------------- + float SAL_CALL OKeySet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getFloat" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getFloat(columnIndex); } -// ------------------------------------------------------------------------- + double SAL_CALL OKeySet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getDouble" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getDouble(columnIndex); } -// ------------------------------------------------------------------------- + Sequence< sal_Int8 > SAL_CALL OKeySet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBytes" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBytes(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Date SAL_CALL OKeySet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getDate" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getDate(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Time SAL_CALL OKeySet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getTime" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getTime(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::DateTime SAL_CALL OKeySet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getTimestamp" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getTimestamp(columnIndex); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL OKeySet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBinaryStream" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBinaryStream(columnIndex); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL OKeySet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getCharacterStream" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getCharacterStream(columnIndex); } -// ------------------------------------------------------------------------- + Any SAL_CALL OKeySet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getObject" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getObject(columnIndex,typeMap); } -// ------------------------------------------------------------------------- + Reference< XRef > SAL_CALL OKeySet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getRef" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getRef(columnIndex); } -// ------------------------------------------------------------------------- + Reference< XBlob > SAL_CALL OKeySet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getBlob" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getBlob(columnIndex); } -// ------------------------------------------------------------------------- + Reference< XClob > SAL_CALL OKeySet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getClob" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getClob(columnIndex); } -// ------------------------------------------------------------------------- + Reference< XArray > SAL_CALL OKeySet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::getArray" ); OSL_ENSURE(m_xRow.is(),"m_xRow is null!"); return m_xRow->getArray(columnIndex); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::rowUpdated( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowUpdated" ); return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 2; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::rowInserted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowInserted" ); return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 1; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowDeleted" ); @@ -1621,7 +1565,7 @@ sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException) m_bDeleted = sal_False; return bDeleted; } -// ----------------------------------------------------------------------------- + ::rtl::OUString OKeySet::getComposedTableName(const ::rtl::OUString& _sCatalog, const ::rtl::OUString& _sSchema, const ::rtl::OUString& _sTable) @@ -1654,7 +1598,7 @@ sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException) return aComposedName; } -// ----------------------------------------------------------------------------- + namespace dbaccess { @@ -1699,7 +1643,7 @@ void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns, sal_Int32 nNullable = ColumnValue::NULLABLE_UNKNOWN; OSL_VERIFY( xQueryColumnProp->getPropertyValue( PROPERTY_ISNULLABLE ) >>= nNullable ); - + if ( i_bAppendTableName ) { ::rtl::OUStringBuffer sName; @@ -1709,11 +1653,11 @@ void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns, SelectColumnDescription aColDesc( nPos, nType,nScale,nNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault ); aColDesc.sRealName = sRealName; aColDesc.sTableName = sTableName; - o_rColumnNames[sName.makeStringAndClear()] = aColDesc; + o_rColumnNames[sName.makeStringAndClear()] = aColDesc; } else o_rColumnNames[sRealName] = SelectColumnDescription( nPos, nType,nScale,nNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault ); - + break; } } @@ -1721,7 +1665,7 @@ void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns, } } } -// ----------------------------------------------------------------------------- + void OKeySet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData) { ORowSetValue& aValue((_rInsertRow->get())[i_aMetaData.nPosition]); @@ -1742,5 +1686,4 @@ void OKeySet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const Select break; } } -// ----------------------------------------------------------------------------- - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index 3ce26fcae..99326960c 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,24 +29,16 @@ #ifndef DBACCESS_CORE_API_KEYSET_HXX #define DBACCESS_CORE_API_KEYSET_HXX -#ifndef DBACCESS_CORE_API_CACHESET_HXX #include "CacheSet.hxx" -#endif -#ifndef _CPPUHELPER_IMPLBASE1_HXX_ #include <cppuhelper/implbase1.hxx> -#endif #include <memory> #include <map> -#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> -#endif #include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> -#ifndef _COMPHELPER_STLTYPES_HXX_ #include <comphelper/stl_types.hxx> -#endif namespace dbaccess { @@ -59,8 +52,6 @@ namespace dbaccess sal_Int32 nScale; sal_Bool bNullable; - - SelectColumnDescription() :nPosition( 0 ) ,nType( 0 ) @@ -96,7 +87,7 @@ namespace dbaccess protected: OKeySetMatrix m_aKeyMap; OKeySetMatrix::iterator m_aKeyIter; - + ::std::vector< ::rtl::OUString > m_aAutoColumns; // contains all columns which are autoincrement ones OUpdatedParameter m_aUpdatedParameter; // contains all parameter which have been updated and are needed for refetching @@ -114,7 +105,7 @@ namespace dbaccess ::rtl::OUString m_sUpdateTableName; ::std::vector< ::rtl::OUString > m_aFilterColumns; sal_Int32& m_rRowCount; - + sal_Bool m_bRowCountFinal; /** @@ -136,7 +127,7 @@ namespace dbaccess + \param i_nBookmark The bookmark is used to update the parameter */ void copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark); - + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getKeyColumns() const; void fillAllRows(); sal_Bool fetchRow(); @@ -153,7 +144,7 @@ namespace dbaccess void executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,const ::std::vector<sal_Int32>& _aIndexColumnPositions = ::std::vector<sal_Int32>()); void executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName = ::rtl::OUString(),bool bRefetch = false); void executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OUString& i_sRowSetFilter,::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer>& io_xAnalyzer); - + virtual ~OKeySet(); public: OKeySet(const connectivity::OSQLTable& _xTable, @@ -163,7 +154,7 @@ namespace dbaccess const ORowSetValueVector& _aParameterValueForCache, sal_Int32 i_nMaxRows, sal_Int32& o_nRowCount); - + // late ctor which can throw exceptions virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); @@ -210,17 +201,17 @@ namespace dbaccess virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // ::com::sun::star::sdbcx::XRowLocate virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // ------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // ------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // ------------------------------------------------------------------------- + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // ------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // ------------------------------------------------------------------------- + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - // ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XDeleteRows virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ,const connectivity::OSQLTable& _xTable) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // ::com::sun::star::sdbc::XResultSetUpdate @@ -239,3 +230,4 @@ namespace dbaccess } #endif // DBACCESS_CORE_API_KEYSET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index ed522c1aa..8e8fc2386 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -1,14 +1,13 @@ + +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OptimisticSet.cxx,v $ - * $Revision: 1.73 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -98,7 +97,7 @@ namespace } DBG_NAME(OptimisticSet) -// ------------------------------------------------------------------------- + OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, const Reference< XConnection>& i_xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xComposer, @@ -113,12 +112,12 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::OptimisticSet" ); DBG_CTOR(OptimisticSet,NULL); } -// ----------------------------------------------------------------------------- + OptimisticSet::~OptimisticSet() { DBG_DTOR(OptimisticSet,NULL); } -// ----------------------------------------------------------------------------- + void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::construct" ); @@ -174,23 +173,23 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const :: m_xStatement = m_xConnection->prepareStatement(xAnalyzer->getQueryWithSubstitution()); ::comphelper::disposeComponent(xAnalyzer); } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL OptimisticSet::deleteRows( const Sequence< Any >& /*rows*/ ,const connectivity::OSQLTable& /*_xTable*/) throw(SQLException, RuntimeException) { Sequence< sal_Int32 > aRet; return aRet; } -// ------------------------------------------------------------------------- + void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::updateRow" ); if ( m_aJoinedKeyColumns.empty() ) throw SQLException(); // list all cloumns that should be set - static ::rtl::OUString s_sPara = ::rtl::OUString::createFromAscii(" = ?"); + static ::rtl::OUString s_sPara(RTL_CONSTASCII_USTRINGPARAM(" = ?")); ::rtl::OUString aQuote = getIdentifierQuoteString(); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")); ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); @@ -201,7 +200,6 @@ void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORow TSQLStatements aIndexConditions; TSQLStatements aSql; - // sal_Int32 i = 1; // here we build the condition part for the update statement SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin(); SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end(); @@ -258,10 +256,8 @@ void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORow sSql.append(s_sSET); sSql.append(aSqlIter->second); ::rtl::OUStringBuffer& rCondition = aKeyConditions[aSqlIter->first]; - bool bAddWhere = true; if ( rCondition.getLength() ) { - bAddWhere = false; sSql.appendAscii(" WHERE "); sSql.append( rCondition ); } @@ -269,7 +265,7 @@ void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORow } } } -// ------------------------------------------------------------------------- + void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::insertRow" ); @@ -278,10 +274,10 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn TSQLStatements aKeyConditions; ::std::map< ::rtl::OUString,bool > aResultSetChanged; ::rtl::OUString aQuote = getIdentifierQuoteString(); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")); ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); - + // here we build the condition part for the update statement SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin(); SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end(); @@ -289,7 +285,7 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn { if ( aResultSetChanged.find( aIter->second.sTableName ) == aResultSetChanged.end() ) aResultSetChanged[aIter->second.sTableName] = false; - + const ::rtl::OUString sQuotedColumnName = ::dbtools::quoteName( aQuote,aIter->second.sRealName); if ( (_rInsertRow->get())[aIter->second.nPosition].isModified() ) { @@ -368,19 +364,19 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn if ( xRow.is() && xRes->next() ) { m_bResultSetChanged = true; - continue; + continue; } } catch(const SQLException&) { } } - + executeInsert(_rInsertRow,sSql.makeStringAndClear(),aSqlIter->first); } } } -// ------------------------------------------------------------------------- + void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); @@ -394,7 +390,6 @@ void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const conne TSQLStatements aIndexConditions; TSQLStatements aSql; - // sal_Int32 i = 1; // here we build the condition part for the update statement SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin(); SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end(); @@ -426,12 +421,12 @@ void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const conne } } } -// ------------------------------------------------------------------------- + void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::executeDelete" ); - // now create end execute the prepared statement + // now create and execute the prepared statement Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL)); Reference< XParameters > xParameter(xPrep,UNO_QUERY); @@ -454,41 +449,17 @@ void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUS m_bDeleted = sal_True; } } -// ----------------------------------------------------------------------------- + ::rtl::OUString OptimisticSet::getComposedTableName(const ::rtl::OUString& /*_sCatalog*/, const ::rtl::OUString& /*_sSchema*/, const ::rtl::OUString& /*_sTable*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getComposedTableName" ); ::rtl::OUString aComposedName; -/* - Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData(); - if( xMetaData.is() && xMetaData->supportsTableCorrelationNames() ) - { - aComposedName = ::dbtools::composeTableName( xMetaData, _sCatalog, _sSchema, _sTable, sal_False, ::dbtools::eInDataManipulation ); - // first we have to check if the composed tablename is in the select clause or if an alias is used - Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY); - Reference<XNameAccess> xSelectTables = xTabSup->getTables(); - OSL_ENSURE(xSelectTables.is(),"No Select tables!"); - if(xSelectTables.is()) - { - if(!xSelectTables->hasByName(aComposedName)) - { // the composed name isn't used in the select clause so we have to find out which name is used instead - ::rtl::OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(xMetaData,m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); - aComposedName = ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ); - } - else - aComposedName = ::dbtools::composeTableNameForSelect( m_xConnection, _sCatalog, _sSchema, _sTable ); - } - } - else - aComposedName = ::dbtools::composeTableNameForSelect( m_xConnection, _sCatalog, _sSchema, _sTable ); -*/ return aComposedName; } -// ----------------------------------------------------------------------------- + void OptimisticSet::fillJoinedColumns_throw(const ::std::vector< TNodePair >& i_aJoinColumns) { ::std::vector< TNodePair >::const_iterator aIter = i_aJoinColumns.begin(); @@ -507,9 +478,9 @@ void OptimisticSet::fillJoinedColumns_throw(const ::std::vector< TNodePair >& i_ fillJoinedColumns_throw(sLeft.makeStringAndClear(),sRight.makeStringAndClear()); } } -// ----------------------------------------------------------------------------- + void OptimisticSet::fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn,const ::rtl::OUString& i_sRightColumn) -{ +{ sal_Int32 nLeft = 0,nRight = 0; SelectColumnsMetaData::const_iterator aLeftIter = m_pKeyColumnNames->find(i_sLeftColumn); SelectColumnsMetaData::const_iterator aRightIter = m_pKeyColumnNames->find(i_sRightColumn); @@ -547,14 +518,14 @@ void OptimisticSet::fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn else m_aJoinedColumns[nRight] = nLeft; } -// ----------------------------------------------------------------------------- + bool OptimisticSet::isResultSetChanged() const { bool bOld = m_bResultSetChanged; m_bResultSetChanged = false; return bOld; } -// ----------------------------------------------------------------------------- + void OptimisticSet::reset(const Reference< XResultSet>& _xDriverSet) { OCacheSet::construct(_xDriverSet,::rtl::OUString()); @@ -563,7 +534,7 @@ void OptimisticSet::reset(const Reference< XResultSet>& _xDriverSet) m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL)))); m_aKeyIter = m_aKeyMap.begin(); } -// ----------------------------------------------------------------------------- + void OptimisticSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,::std::vector<sal_Int32>& o_aChangedColumns) { o_aChangedColumns.push_back(i_nColumnIndex); @@ -605,7 +576,7 @@ namespace } }; } -// ----------------------------------------------------------------------------- + bool OptimisticSet::updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns) { bool bRet = false; @@ -642,7 +613,7 @@ bool OptimisticSet::updateColumnValues(const ORowSetValueVector::Vector& io_aCac } return bRet; } -// ----------------------------------------------------------------------------- + bool OptimisticSet::columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow) { bool bRet = false; @@ -681,14 +652,14 @@ bool OptimisticSet::columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow } return bRet; } -// ----------------------------------------------------------------------------- + void OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const { TSQLStatements aSql; TSQLStatements aKeyConditions; ::std::map< ::rtl::OUString,bool > aResultSetChanged; ::rtl::OUString aQuote = getIdentifierQuoteString(); - static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND "); + static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM(" AND ")); ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")); ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?")); // here we build the condition part for the update statement @@ -765,5 +736,4 @@ void OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const } } } -// ----------------------------------------------------------------------------- - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx index c2b985760..b9b8fbe11 100644 --- a/dbaccess/source/core/api/OptimisticSet.hxx +++ b/dbaccess/source/core/api/OptimisticSet.hxx @@ -1,14 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: KeySet.hxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,11 +47,10 @@ namespace dbaccess { ::connectivity::OSQLParser m_aSqlParser; ::connectivity::OSQLParseTreeIterator m_aSqlIterator; - + ::std::map<sal_Int32,sal_Int32> m_aJoinedColumns; - ::std::map<sal_Int32,sal_Int32> m_aJoinedKeyColumns; - - + ::std::map<sal_Int32,sal_Int32> m_aJoinedKeyColumns; + mutable bool m_bResultSetChanged; /** @@ -67,9 +64,9 @@ namespace dbaccess ::rtl::OUString getComposedTableName( const ::rtl::OUString& _sCatalog, const ::rtl::OUString& _sSchema, const ::rtl::OUString& _sTable); - + void impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData); - + void executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName); void fillJoinedColumns_throw(const ::std::vector< ::connectivity::TNodePair>& i_aJoinColumns); void fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn,const ::rtl::OUString& i_sRightColumn); @@ -82,11 +79,10 @@ namespace dbaccess const ORowSetValueVector& _aParameterValueForCache, sal_Int32 i_nMaxRows, sal_Int32& o_nRowCount); - + // late ctor which can throw exceptions virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); - // ------------------------------------------------------------------------- // ::com::sun::star::sdbcx::XDeleteRows virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ,const connectivity::OSQLTable& _xTable) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // ::com::sun::star::sdbc::XResultSetUpdate @@ -109,3 +105,4 @@ namespace dbaccess } #endif // DBACCESS_CORE_API_OPTIMISTICSET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/PrivateRow.cxx b/dbaccess/source/core/api/PrivateRow.cxx index 2d3baedc4..05eed3b2b 100644 --- a/dbaccess/source/core/api/PrivateRow.cxx +++ b/dbaccess/source/core/api/PrivateRow.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle andor its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -140,3 +141,4 @@ using namespace ::com::sun::star; return Reference< XArray >(m_aRow[m_nPos].makeAny(),UNO_QUERY); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/PrivateRow.hxx b/dbaccess/source/core/api/PrivateRow.hxx index aabcb0d4a..e03e8dcdc 100644 --- a/dbaccess/source/core/api/PrivateRow.hxx +++ b/dbaccess/source/core/api/PrivateRow.hxx @@ -1,14 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OptimisticSet.cxx,v $ - * $Revision: 1.73 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -67,3 +65,5 @@ namespace dbaccess }; } // dbaccess #endif // PRIVATE_ROW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index dd0643b01..3825516e4 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,6 +41,7 @@ #include "core_resource.hrc" #include "core_resource.hxx" #include "tablecontainer.hxx" +#include "dbastrings.hrc" /** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -102,12 +104,10 @@ using namespace ::com::sun::star::util; using namespace ::cppu; using namespace ::osl; -//-------------------------------------------------------------------------- extern "C" void SAL_CALL createRegistryInfo_ORowSet() { static ::dba::OAutoRegistration< ORowSet > aAutoRegistration; } -// ----------------------------------------------------------------------------- #define NOTIFY_LISTERNERS_CHECK(_rListeners,T,method) \ Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ @@ -134,16 +134,14 @@ extern "C" void SAL_CALL createRegistryInfo_ORowSet() _rGuard.reset(); -//.................................................................. namespace dbaccess { -//.................................................................. -//-------------------------------------------------------------------------- + Reference< XInterface > ORowSet_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) { return *(new ORowSet(_rxFactory)); } -//-------------------------------------------------------------------------- + ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ) :ORowSet_BASE1(m_aMutex) ,ORowSetBase( _rxORB, ORowSet_BASE1::rBHelper, &m_aMutex ) @@ -170,6 +168,7 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory ,m_bNew(sal_False) ,m_bCanUpdateInsertedRows(sal_True) ,m_bOwnConnection(sal_False) + ,m_bPropChangeNotifyEnabled(sal_True) { m_nResultSetType = ResultSetType::SCROLL_SENSITIVE; m_nResultSetConcurrency = ResultSetConcurrency::UPDATABLE; @@ -222,19 +221,21 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND, &m_aUpdateCatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND, &m_aUpdateSchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND, &m_aUpdateTableName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + + // ??? + registerProperty(PROPERTY_CHANGE_NOTIFICATION_ENABLED, PROPERTY_ID_PROPCHANGE_NOTIFY, PropertyAttribute::BOUND, &m_bPropChangeNotifyEnabled, ::getBooleanCppuType()); } ORowSet::~ORowSet() { if ( !m_rBHelper.bDisposed && !m_rBHelper.bInDispose ) { - OSL_ENSURE(0, "Please check who doesn't dispose this component!"); + OSL_FAIL("Please check who doesn't dispose this component!"); osl_incrementInterlockedCount( &m_refCount ); dispose(); } } -// ----------------------------------------------------------------------------- void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const { switch( _nHandle ) @@ -286,9 +287,8 @@ void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) c break; } } -// ------------------------------------------------------------------------- -// typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_Prop; +// typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_Prop; void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) { switch(nHandle) @@ -373,11 +373,14 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const case PROPERTY_ID_TYPEMAP: ::cppu::extractInterface(m_xTypeMap,m_aTypeMap); break; + case PROPERTY_ID_PROPCHANGE_NOTIFY: + m_bPropChangeNotifyEnabled = ::cppu::any2bool(rValue); + break; default: break; }; } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const { if(m_pCache) @@ -413,12 +416,15 @@ void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const case PROPERTY_ID_TYPEMAP: rValue <<= m_xTypeMap; break; + case PROPERTY_ID_PROPCHANGE_NOTIFY: + rValue <<= m_bPropChangeNotifyEnabled; + break; default: ORowSetBase::getFastPropertyValue(rValue,nHandle); } } } -// ------------------------------------------------------------------------- + // com::sun::star::XTypeProvider Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException) { @@ -428,7 +434,7 @@ Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException) ::comphelper::concatSequences(ORowSet_BASE1::getTypes(),ORowSetBase::getTypes())); return aTypes.getTypes(); } -// ------------------------------------------------------------------------- + Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeException) { static OImplementationId * pId = 0; @@ -443,24 +449,22 @@ Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeExcep } return pId->getImplementationId(); } -// ------------------------------------------------------------------------- // com::sun::star::XInterface Any SAL_CALL ORowSet::queryInterface( const Type & rType ) throw (RuntimeException) { return ORowSet_BASE1::queryInterface( rType); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::acquire() throw() { ORowSet_BASE1::acquire(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::release() throw() { ORowSet_BASE1::release(); } -// ------------------------------------------------------------------------- // com::sun::star::XUnoTunnel sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) @@ -470,7 +474,7 @@ sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) thro return 0; } -// ------------------------------------------------------------------------- + // com::sun::star::XAggregation Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeException) { @@ -479,23 +483,23 @@ Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeExcepti aRet = ORowSet_BASE1::queryAggregation(rType); return aRet; } -//------------------------------------------------------------------------------ + rtl::OUString ORowSet::getImplementationName_static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.comp.dba.ORowSet"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.dba.ORowSet")); } -// ------------------------------------------------------------------------- + // ::com::sun::star::XServiceInfo ::rtl::OUString SAL_CALL ORowSet::getImplementationName( ) throw(RuntimeException) { return getImplementationName_static(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static( ) throw (RuntimeException) { Sequence< rtl::OUString > aSNS( 5 ); @@ -506,18 +510,18 @@ Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static( ) throw ( aSNS[4] = SERVICE_SDB_ROWSET; return aSNS; } -// ------------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL ORowSet::getSupportedServiceNames( ) throw(RuntimeException) { return getSupportedServiceNames_static(); } -//------------------------------------------------------------------------------ + Reference< XInterface > ORowSet::Create(const Reference< XComponentContext >& _rxContext) { ::comphelper::ComponentContext aContext( _rxContext ); return ORowSet_CreateInstance( aContext.getLegacyServiceFactory() ); } -// ------------------------------------------------------------------------- + // OComponentHelper void SAL_CALL ORowSet::disposing() { @@ -549,14 +553,14 @@ void SAL_CALL ORowSet::disposing() ORowSetBase::disposing(); } -// ------------------------------------------------------------------------- + void ORowSet::freeResources( bool _bComplete ) { MutexGuard aGuard(m_aMutex); // free all clones connectivity::OWeakRefArray::iterator aEnd = m_aClones.end(); - for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++) + for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; ++i) { Reference< XComponent > xComp(i->get(), UNO_QUERY); if (xComp.is()) @@ -598,7 +602,7 @@ void ORowSet::freeResources( bool _bComplete ) m_bIsInsertRow = sal_False; m_bLastKnownRowCountFinal = sal_False; m_nLastKnownRowCount = 0; - if ( m_aOldRow.isValid() ) + if ( m_aOldRow.is() ) m_aOldRow->clearRow(); impl_disposeParametersContainer_nothrow(); @@ -607,7 +611,6 @@ void ORowSet::freeResources( bool _bComplete ) } } -// ------------------------------------------------------------------------- void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Bool _bFireEvent ) { if (_rxNewConn.get() == m_xActiveConnection.get()) @@ -653,7 +656,6 @@ void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Boo } } -// ------------------------------------------------------------------------- // ::com::sun::star::XEventListener void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) { @@ -669,7 +671,6 @@ void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Sou } } } -// ------------------------------------------------------------------------- // XCloseable void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) @@ -681,7 +682,7 @@ void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) // additionals things to set freeResources( true ); } -// ------------------------------------------------------------------------- + // comphelper::OPropertyArrayUsageHelper ::cppu::IPropertyArrayHelper* ORowSet::createArrayHelper( ) const { @@ -689,14 +690,14 @@ void SAL_CALL ORowSet::close( ) throw(SQLException, RuntimeException) describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); } -// ------------------------------------------------------------------------- + // cppu::OPropertySetHelper ::cppu::IPropertyArrayHelper& SAL_CALL ORowSet::getInfoHelper() { typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_PROP; return *ORowSet_PROP::getArrayHelper(); } -// ----------------------------------------------------------------------------- + void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -711,7 +712,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } -// ------------------------------------------------------------------------- + // XRowUpdate void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { @@ -727,92 +728,82 @@ void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, R m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { updateValue(columnIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkUpdateConditions(columnIndex); checkUpdateIterator(); - - //if(((*m_aCurrentRow)->get())[columnIndex].getTypeKind() == DataType::BLOB) - //{ - // ::connectivity::ORowSetValue aOldValue = ((*m_aCurrentRow)->get())[columnIndex]; - // m_pCache->updateBinaryStream(columnIndex,x,length); - // ((*m_aCurrentRow)->get())[columnIndex] = makeAny(x); - // ((*m_aCurrentRow)->get())[columnIndex].setTypeKind(DataType::BLOB); - // firePropertyChange(columnIndex-1 ,aOldValue); - // fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False); - //} - //else - { + + { Sequence<sal_Int8> aSeq; if(x.is()) x->readBytes(aSeq,length); updateValue(columnIndex,aSeq); } } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -825,7 +816,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -870,7 +861,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw aNotify.firePropertyChange(); } } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -883,7 +874,6 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } -// ------------------------------------------------------------------------- // XResultSetUpdate void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) @@ -894,7 +884,7 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) // when the row isn't modified // or the concurency is read only ::osl::ResettableMutexGuard aGuard( *m_pMutex ); - + if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) throwFunctionSequenceException(*this); @@ -903,7 +893,7 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) ORowSetRow aOldValues; if ( !m_aCurrentRow.isNull() ) - aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() ); + aOldValues = new ORowSetValueVector( *(*m_aCurrentRow)); Sequence<Any> aChangedBookmarks; RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks); notifyAllListenersRowBeforeChange(aGuard,aEvt); @@ -923,7 +913,7 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) // - rowChanged notifyAllListenersRowChanged(aGuard,aEvt); - + if ( !aBookmarks.empty() ) { RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size())); @@ -942,16 +932,16 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) // - RowCount/IsRowCountFinal fireRowcount(); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); - checkCache(); + checkCache(); // check if we are inserting a row return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -959,13 +949,13 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) ::osl::ResettableMutexGuard aGuard( *m_pMutex ); if ( !m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY || m_bNew || ((m_pCache->m_nPrivileges & Privilege::UPDATE ) != Privilege::UPDATE) ) throwFunctionSequenceException(*this); - + if(m_bModified) { ORowSetRow aOldValues; if ( !m_aCurrentRow.isNull() ) - aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() ); + aOldValues = new ORowSetValueVector( *(*m_aCurrentRow) ); Sequence<Any> aChangedBookmarks; RowsChangeEvent aEvt(*this,RowChangeAction::UPDATE,1,aChangedBookmarks); @@ -974,12 +964,11 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) ::std::vector< Any > aBookmarks; m_pCache->updateRow(m_aCurrentRow.operator ->(),aBookmarks); if ( !aBookmarks.empty() ) - aEvt.Bookmarks = Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()); + aEvt.Bookmarks = Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()); aEvt.Rows += aBookmarks.size(); m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; - m_bIsInsertRow = sal_False; - if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).isValid() ) + if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).is() ) { if ( m_pCache->isResultSetChanged() ) { @@ -987,7 +976,7 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) } else { - m_aOldRow->setRow(new ORowSetValueVector(m_aCurrentRow->getBody())); + m_aOldRow->setRow(new ORowSetValueVector(*(*m_aCurrentRow))); // notification order // - column values @@ -1010,7 +999,7 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) } } } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1037,8 +1026,8 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) notifyRowSetAndClonesRowDelete( aBookmarkToDelete ); ORowSetRow aOldValues; - if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && m_pCache->m_aMatrixIter->isValid() ) - aOldValues = new ORowSetValueVector( m_pCache->m_aMatrixIter->getBody() ); + if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && m_pCache->m_aMatrixIter->is() ) + aOldValues = new ORowSetValueVector( *(*(m_pCache->m_aMatrixIter)) ); Sequence<Any> aChangedBookmarks; RowsChangeEvent aEvt(*this,RowChangeAction::DELETE,1,aChangedBookmarks); @@ -1062,7 +1051,6 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) fireRowcount(); } -// ------------------------------------------------------------------------- void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQLException, RuntimeException ) ) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1083,7 +1071,7 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL ORowSetRow aOldValues; if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() ) - aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() ); + aOldValues = new ORowSetValueVector( *(*m_aCurrentRow) ); m_pCache->cancelRowUpdates(); @@ -1102,13 +1090,11 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL } } -// ------------------------------------------------------------------------- void SAL_CALL ORowSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { implCancelRowUpdates( sal_True ); } -// ------------------------------------------------------------------------- void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1117,7 +1103,7 @@ void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& li if(listener.is()) m_aRowsetListeners.addInterface(listener); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1126,7 +1112,7 @@ void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& if(listener.is()) m_aRowsetListeners.removeInterface(listener); } -// ----------------------------------------------------------------------------- + void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) { EventObject aEvt(*m_pMySelf); @@ -1134,7 +1120,7 @@ void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) m_aRowsetListeners.notifyEach( &XRowSetListener::rowSetChanged, aEvt ); _rGuard.reset(); } -// ------------------------------------------------------------------------- + void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard) { EventObject aEvt(*m_pMySelf); @@ -1142,7 +1128,7 @@ void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard m_aRowsetListeners.notifyEach( &XRowSetListener::cursorMoved, aEvt ); _rGuard.reset(); } -// ------------------------------------------------------------------------- + void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, const RowsChangeEvent& aEvt) { _rGuard.clear(); @@ -1150,21 +1136,21 @@ void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, m_aRowsChangeListener.notifyEach( &XRowsChangeListener::rowsChanged, aEvt ); _rGuard.reset(); } -// ------------------------------------------------------------------------- + sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard) { EventObject aEvt(*m_pMySelf); NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveCursorMove); return bCheck; } -// ------------------------------------------------------------------------- + void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const RowChangeEvent &aEvt) { NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveRowChange); if ( !bCheck ) m_aErrors.raiseTypedException( sdb::ErrorCondition::ROW_SET_OPERATION_VETOED, *this, ::cppu::UnoType< RowSetVetoException >::get() ); } -// ------------------------------------------------------------------------- + void ORowSet::fireRowcount() { sal_Int32 nCurrentRowCount( impl_getRowCount() ); @@ -1188,7 +1174,7 @@ void ORowSet::fireRowcount() m_bLastKnownRowCountFinal = bCurrentRowCountFinal; } } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1215,9 +1201,9 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) if ( !m_bBeforeFirst && !m_bAfterLast && m_pCache->m_aMatrixIter != m_pCache->getEnd() - && m_pCache->m_aMatrixIter->isValid() + && m_pCache->m_aMatrixIter->is() ) - aOldValues = new ORowSetValueVector( m_pCache->m_aMatrixIter->getBody() ); + aOldValues = new ORowSetValueVector( *(*(m_pCache->m_aMatrixIter)) ); const sal_Bool bNewState = m_bNew; const sal_Bool bModState = m_bModified; @@ -1248,34 +1234,34 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) fireRowcount(); } } -// ------------------------------------------------------------------------- + void ORowSet::impl_setDataColumnsWriteable_throw() { impl_restoreDataColumnsWriteable_throw(); TDataColumns::iterator aIter = m_aDataColumns.begin(); m_aReadOnlyDataColumns.resize(m_aDataColumns.size(),false); - ::std::bit_vector::iterator aReadIter = m_aReadOnlyDataColumns.begin(); + ::std::vector<bool, std::allocator<bool> >::iterator aReadIter = m_aReadOnlyDataColumns.begin(); for(;aIter != m_aDataColumns.end();++aIter,++aReadIter) { sal_Bool bReadOnly = sal_False; (*aIter)->getPropertyValue(PROPERTY_ISREADONLY) >>= bReadOnly; *aReadIter = bReadOnly; - + (*aIter)->setPropertyValue(PROPERTY_ISREADONLY,makeAny(sal_False)); } } -// ------------------------------------------------------------------------- + void ORowSet::impl_restoreDataColumnsWriteable_throw() { TDataColumns::iterator aIter = m_aDataColumns.begin(); - ::std::bit_vector::iterator aReadIter = m_aReadOnlyDataColumns.begin(); + ::std::vector<bool, std::allocator<bool> >::iterator aReadIter = m_aReadOnlyDataColumns.begin(); for(;aReadIter != m_aReadOnlyDataColumns.end();++aIter,++aReadIter) { (*aIter)->setPropertyValue(PROPERTY_ISREADONLY,makeAny((sal_Bool)*aReadIter )); } m_aReadOnlyDataColumns.clear(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1310,7 +1296,7 @@ void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException aNotifier.fire(); } } -// ------------------------------------------------------------------------- + // XRow sal_Bool SAL_CALL ORowSet::wasNull( ) throw(SQLException, RuntimeException) { @@ -1319,7 +1305,7 @@ sal_Bool SAL_CALL ORowSet::wasNull( ) throw(SQLException, RuntimeException) return ( m_pCache && isInsertRow() ) ? ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex].isNull() : ORowSetBase::wasNull(); } -// ----------------------------------------------------------------------------- + const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex) { checkCache(); @@ -1329,79 +1315,79 @@ const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex) return getValue(columnIndex); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); @@ -1413,7 +1399,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStrea return ORowSetBase::getBinaryStream(columnIndex); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); @@ -1425,18 +1411,18 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterSt return ORowSetBase::getCharacterStream(columnIndex); } -// ------------------------------------------------------------------------- + Any SAL_CALL ORowSet::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); return getInsertValue(columnIndex).makeAny(); } -// ------------------------------------------------------------------------- + Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { return Reference< XRef >(); } -// ------------------------------------------------------------------------- + Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { if ( m_pCache && isInsertRow() ) @@ -1446,17 +1432,17 @@ Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 columnIndex ) throw(SQLE } return ORowSetBase::getBlob(columnIndex); } -// ------------------------------------------------------------------------- + Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { return Reference< XClob >(getInsertValue(columnIndex).makeAny(),UNO_QUERY); } -// ------------------------------------------------------------------------- + Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { return Reference< XArray >(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException) { if (!_rxHandler.is()) @@ -1490,7 +1476,7 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl const sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0; if ( m_aParametersSet.size() < (size_t)nParamCount ) m_aParametersSet.resize( nParamCount ,false); - + ::dbtools::askForParameters( xComposer, this, m_xActiveConnection, _rxHandler,m_aParametersSet ); } // ensure that only the allowed exceptions leave this block @@ -1504,7 +1490,7 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl } catch(Exception&) { - DBG_ERROR("ORowSet::executeWithCompletion: caught an unexpected exception type while filling in the parameters!"); + OSL_FAIL("ORowSet::executeWithCompletion: caught an unexpected exception type while filling in the parameters!"); } // we're done with the parameters, now for the real execution @@ -1513,7 +1499,6 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl execute_NoApprove_NoNewConn(aGuard); } -// ------------------------------------------------------------------------- Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) throw (RuntimeException) { ::osl::MutexGuard aGuard( *m_pMutex ); @@ -1540,7 +1525,6 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) throw (RuntimeExce return m_pParameters.get(); } -// ------------------------------------------------------------------------- void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException) { ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -1568,9 +1552,8 @@ void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException) } } } -// ------------------------------------------------------------------------- + // XRowSet -// ------------------------------------------------------------------------- void SAL_CALL ORowSet::execute( ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -1595,7 +1578,6 @@ void SAL_CALL ORowSet::execute( ) throw(SQLException, RuntimeException) execute_NoApprove_NoNewConn(aGuard); } -//------------------------------------------------------------------------------ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxStatement, sal_Int32 _nDesiredResultSetType, sal_Int32 _nDesiredResultSetConcurrency ) { OSL_ENSURE( _rxStatement.is(), "ORowSet::setStatementResultSetType: invalid statement - this will crash!" ); @@ -1604,7 +1586,7 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta sal_Int32 nResultSetConcurrency( _nDesiredResultSetConcurrency ); // there *might* be a data source setting which tells use to be more defensive with those settings - // #i15113# / 2005-02-10 / frank.schoenheit@sun.com + // #i15113# sal_Bool bRespectDriverRST = sal_False; Any aSetting; if ( getDataSourceSetting( ::dbaccess::getDataSource( m_xActiveConnection ), "RespectDriverResultSetType", aSetting ) ) @@ -1649,7 +1631,6 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, makeAny( nResultSetConcurrency ) ); } -// ----------------------------------------------------------------------------- Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() { ::rtl::OUString sCommandToExecute; @@ -1711,7 +1692,6 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() return xResultSet; } -// ----------------------------------------------------------------------------- void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertySet >& _rxTemplateColumn, const Reference< XPropertySet >& _rxRowSetColumn ) { OSL_ENSURE( _rxTemplateColumn.is() && _rxRowSetColumn.is(), @@ -1727,7 +1707,7 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS PROPERTY_ALIGN, PROPERTY_RELATIVEPOSITION, PROPERTY_WIDTH, PROPERTY_HIDDEN, PROPERTY_CONTROLMODEL, PROPERTY_HELPTEXT, PROPERTY_CONTROLDEFAULT }; - for ( size_t i=0; i<sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aPropertyNames ); ++i ) { if ( xInfo->hasPropertyByName( aPropertyNames[i] ) ) { @@ -1797,7 +1777,6 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS } } -// ----------------------------------------------------------------------------- void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotification) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn" ); @@ -1840,9 +1819,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi } // get the locale - // ConfigManager* pConfigMgr = ConfigManager::GetConfigManager(); Locale aLocale = SvtSysLocale().GetLocaleData().getLocale(); - // pConfigMgr->GetDirectConfigProperty(ConfigManager::LOCALE) >>= aLocale; // get the numberformatTypes OSL_ENSURE(m_xActiveConnection.is(),"No ActiveConnection"); @@ -1851,10 +1828,9 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi if ( xNumberFormat.is() ) m_xNumberFormatTypes.set(xNumberFormat->getNumberFormats(),UNO_QUERY); - ::vos::ORef< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns(); + ::rtl::Reference< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns(); ::std::vector< ::rtl::OUString> aNames; ::rtl::OUString aDescription; - sal_Int32 nFormatKey = 0; const ::std::map<sal_Int32,sal_Int32>& rKeyColumns = m_pCache->getKeyColumns(); if(!m_xColumns.is()) @@ -1905,7 +1881,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi try { - nFormatKey = 0; + sal_Int32 nFormatKey = 0; if(m_xNumberFormatTypes.is()) nFormatKey = ::dbtools::getDefaultNumberFormat(pColumn,m_xNumberFormatTypes,aLocale); @@ -1948,7 +1924,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi m_xColumns->getByName(sColumnLabel) >>= xColumn; if (!xColumn.is() && m_xColumns->hasByName(sName)) m_xColumns->getByName(sName) >>= xColumn; - + // check if column already in the list we need another if ( aAllColumns.find( xColumn ) != aAllColumns.end() ) { @@ -1959,8 +1935,6 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi if(!xColumn.is()) { // no column found so we could look at the position i - //bReFetchName = sal_True; - //sColumnLabel = ::rtl::OUString(); Reference<XIndexAccess> xIndexAccess(m_xColumns,UNO_QUERY); if(xIndexAccess.is() && i <= xIndexAccess->getCount()) { @@ -2000,9 +1974,9 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi sParseLabel, m_aCurrentRow); aColumns->get().push_back(pColumn); - + pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i) != rKeyColumns.end())); - + if(!sColumnLabel.getLength()) { if(xColumn.is()) @@ -2033,7 +2007,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi // notify the rowset listeners notifyAllListeners(_rClearForNotification); } -// ------------------------------------------------------------------------- + // XRowSetApproveBroadcaster void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException) { @@ -2043,7 +2017,7 @@ void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApprove m_aApproveListeners.addInterface(listener); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::removeRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -2061,7 +2035,7 @@ void SAL_CALL ORowSet::addRowsChangeListener( const Reference< XRowsChangeListen m_aRowsChangeListener.addInterface(listener); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::removeRowsChangeListener( const Reference< XRowsChangeListener >& listener ) throw(RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -2070,7 +2044,6 @@ void SAL_CALL ORowSet::removeRowsChangeListener( const Reference< XRowsChangeLis m_aRowsChangeListener.removeInterface(listener); } -// ------------------------------------------------------------------------- // XResultSetAccess Reference< XResultSet > SAL_CALL ORowSet::createResultSet( ) throw(SQLException, RuntimeException) @@ -2086,14 +2059,12 @@ Reference< XResultSet > SAL_CALL ORowSet::createResultSet( ) throw(SQLException } return Reference< XResultSet >(); } -// ------------------------------------------------------------------------- // ::com::sun::star::util::XCancellable void SAL_CALL ORowSet::cancel( ) throw(RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); } -// ------------------------------------------------------------------------- // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException) @@ -2149,14 +2120,14 @@ Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows return aResults; } -// ----------------------------------------------------------------------------- + void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) { // notify ourself onDeleteRow( _rBookmark ); // notify the clones connectivity::OWeakRefArray::iterator aEnd = m_aClones.end(); - for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++) + for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; ++i) { Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY); if(xTunnel.is()) @@ -2167,14 +2138,14 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) } } } -//------------------------------------------------------------------------------ + void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 _nPos ) { // notify ourself onDeletedRow( _rBookmark, _nPos ); // notify the clones connectivity::OWeakRefArray::iterator aEnd = m_aClones.end(); - for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++) + for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; ++i) { Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY); if(xTunnel.is()) @@ -2185,7 +2156,7 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 } } } -//------------------------------------------------------------------------------ + Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionHandler >& _rxHandler) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -2229,7 +2200,7 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH } return m_xActiveConnection; } -//------------------------------------------------------------------------------ + Reference< XNameAccess > ORowSet::impl_getTables_throw() { Reference< XNameAccess > xTables; @@ -2262,14 +2233,13 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() m_pTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,NULL,NULL,NULL,m_nInAppend); xTables = m_pTables; Sequence< ::rtl::OUString> aTableFilter(1); - aTableFilter[0] = ::rtl::OUString::createFromAscii("%"); + aTableFilter[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")); m_pTables->construct(aTableFilter,Sequence< ::rtl::OUString>()); } return xTables; } -//------------------------------------------------------------------------------ void ORowSet::impl_resetTables_nothrow() { if ( !m_pTables ) @@ -2287,7 +2257,6 @@ void ORowSet::impl_resetTables_nothrow() DELETEZ( m_pTables ); } -//------------------------------------------------------------------------------ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecute ) { sal_Bool bUseEscapeProcessing = impl_buildActiveCommand_throw( ); @@ -2318,9 +2287,8 @@ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecu { // append a "0=1" filter // don't simply overwrite an existent filter, this would lead to problems if this existent // filter contains paramters (since a keyset may add parameters itself) - // 2003-12-12 - #23418# - fs@openoffice.org m_xComposer->setElementaryQuery( m_xComposer->getQuery( ) ); - m_xComposer->setFilter( ::rtl::OUString::createFromAscii( "0 = 1" ) ); + m_xComposer->setFilter( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "0 = 1" ) ) ); } m_xComposer->setOrder( m_aOrder ); @@ -2335,11 +2303,10 @@ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecu impl_initParametersContainer_nothrow(); _out_rCommandToExecute = m_xComposer->getQueryWithSubstitution(); - + return bUseEscapeProcessing; } -//------------------------------------------------------------------------------ sal_Bool ORowSet::impl_buildActiveCommand_throw() { // create the sql command @@ -2363,32 +2330,6 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() Reference< XNameAccess > xTables( impl_getTables_throw() ); if ( xTables->hasByName(m_aCommand) ) { -/* - Reference< XPropertySet > xTable; - try - { - xTables->getByName( m_aCommand ) >>= xTable; - } - catch(const WrappedTargetException& e) - { - SQLException e2; - if ( e.TargetException >>= e2 ) - throw e2; - } - catch(Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - - Reference<XColumnsSupplier> xSup(xTable,UNO_QUERY); - if ( xSup.is() ) - m_xColumns = xSup->getColumns(); - - sCommand = rtl::OUString::createFromAscii("SELECT * FROM "); - ::rtl::OUString sCatalog, sSchema, sTable; - ::dbtools::qualifiedNameComponents( m_xActiveConnection->getMetaData(), m_aCommand, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation ); - sCommand += ::dbtools::composeTableNameForSelect( m_xActiveConnection, sCatalog, sSchema, sTable ); -*/ } else { @@ -2399,7 +2340,7 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() } else { - sCommand = rtl::OUString::createFromAscii("SELECT * FROM "); + sCommand = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT * FROM ")); ::rtl::OUString sCatalog, sSchema, sTable; ::dbtools::qualifiedNameComponents( m_xActiveConnection->getMetaData(), m_aCommand, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation ); sCommand += ::dbtools::composeTableNameForSelect( m_xActiveConnection, sCatalog, sSchema, sTable ); @@ -2434,11 +2375,6 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() xQuery->getPropertyValue(PROPERTY_UPDATE_TABLENAME) >>= aTable; if(aTable.getLength()) m_aUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), aCatalog, aSchema, aTable, sal_False, ::dbtools::eInDataManipulation ); -/* - Reference<XColumnsSupplier> xSup(xQuery,UNO_QUERY); - if(xSup.is()) - m_xColumns = xSup->getColumns(); -*/ } } else @@ -2466,7 +2402,6 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() return bDoEscapeProcessing; } -//------------------------------------------------------------------------------ void ORowSet::impl_initParametersContainer_nothrow() { OSL_PRECOND( !m_pParameters.is(), "ORowSet::impl_initParametersContainer_nothrow: already initialized the parameters!" ); @@ -2480,7 +2415,6 @@ void ORowSet::impl_initParametersContainer_nothrow() } } -//------------------------------------------------------------------------------ void ORowSet::impl_disposeParametersContainer_nothrow() { if ( !m_pParameters.is() ) @@ -2498,7 +2432,6 @@ void ORowSet::impl_disposeParametersContainer_nothrow() m_pParameters = NULL; } -// ----------------------------------------------------------------------------- ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) { ::connectivity::checkDisposed( ORowSet_BASE1::rBHelper.bDisposed ); @@ -2531,7 +2464,7 @@ ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex) m_aPrematureParamValues.get().resize( parameterIndex ); return m_aPrematureParamValues.get()[ parameterIndex - 1 ]; } -// ------------------------------------------------------------------------- + // XParameters void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException) { @@ -2539,12 +2472,12 @@ void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ getParameterStorage( parameterIndex ).setNull(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException) { setNull( parameterIndex, sqlType ); } -// ----------------------------------------------------------------------------- + void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x) { ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2552,67 +2485,66 @@ void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x) getParameterStorage( parameterIndex ) = x; } -// ------------------------------------------------------------------------- void SAL_CALL ORowSet::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,x); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2630,7 +2562,7 @@ void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Referenc throw SQLException(); } } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2652,7 +2584,7 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Refer throw SQLException(); } } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { if ( !::dbtools::implSetObject( this, parameterIndex, x ) ) @@ -2660,7 +2592,7 @@ void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw throw SQLException(); } } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aColumnsMutex ); @@ -2668,27 +2600,27 @@ void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x setObject( parameterIndex, x ); rParamValue.setTypeKind( targetSqlType ); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException) { ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this ); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException) { ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this ); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException) { ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this ); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException) { ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this ); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException) { ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed); @@ -2701,21 +2633,18 @@ void SAL_CALL ORowSet::clearParameters( ) throw(SQLException, RuntimeException) m_aParametersSet.clear(); } -// ------------------------------------------------------------------------- Any SAL_CALL ORowSet::getWarnings( ) throw (SQLException, RuntimeException) { return m_aWarnings.getWarnings(); } -// ------------------------------------------------------------------------- void SAL_CALL ORowSet::clearWarnings( ) throw (SQLException, RuntimeException) { m_aWarnings.clearWarnings(); } -// ----------------------------------------------------------------------------- + void ORowSet::doCancelModification( ) { - //OSL_ENSURE( isModification(), "ORowSet::doCancelModification: invalid call (no cache!)!" ); if ( isModification() ) { // read-only flag restored @@ -2726,25 +2655,26 @@ void ORowSet::doCancelModification( ) m_bIsInsertRow = sal_False; } -// ----------------------------------------------------------------------------- sal_Bool ORowSet::isModification( ) { return isNew(); } -// ----------------------------------------------------------------------------- sal_Bool ORowSet::isModified( ) { return m_bModified; } -// ----------------------------------------------------------------------------- sal_Bool ORowSet::isNew( ) { return m_bNew; } -// ----------------------------------------------------------------------------- +sal_Bool ORowSet::isPropertyChangeNotificationEnabled() const +{ + return m_bPropChangeNotifyEnabled; +} + void ORowSet::checkUpdateIterator() { if(!m_bIsInsertRow) @@ -2754,7 +2684,7 @@ void ORowSet::checkUpdateIterator() m_bIsInsertRow = sal_True; } } -// ----------------------------------------------------------------------------- + void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) { checkCache(); @@ -2770,10 +2700,10 @@ void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this ); } -// ----------------------------------------------------------------------------- + void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) { - + ORowSetNotifier aNotifier( this ); // this will call cancelRowModification on the cache if necessary @@ -2788,7 +2718,7 @@ void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) // - IsNew aNotifier.fire( ); } -// ----------------------------------------------------------------------------- + void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard) { Reference< XResultSet > xResultSet( m_xStatement->executeQuery() ); @@ -2800,7 +2730,7 @@ void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard) // ORowSetClone // *********************************************************** DBG_NAME(ORowSetClone); -//-------------------------------------------------------------------------- + ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex ) :OSubComponent(m_aMutex, rParent) ,ORowSetBase( _rContext, OComponentHelper::rBHelper, _pMutex ) @@ -2824,13 +2754,10 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo m_aOldRow = m_pCache->registerOldRow(); - ::vos::ORef< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns(); + ::rtl::Reference< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns(); ::std::vector< ::rtl::OUString> aNames; ::rtl::OUString aDescription; - // ConfigManager* pConfigMgr = ConfigManager::GetConfigManager(); - // Locale aLocale; - // pConfigMgr->GetDirectConfigProperty(ConfigManager::LOCALE) >>= aLocale; Locale aLocale = SvtSysLocale().GetLocaleData().getLocale(); if ( rParent.m_pColumns ) @@ -2873,7 +2800,7 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HELPTEXT,xColumn->getPropertyValue(PROPERTY_HELPTEXT)); pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLDEFAULT,xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT)); - } // for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i) + } } Reference<XDatabaseMetaData> xMeta = rParent.m_xActiveConnection->getMetaData(); m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(), @@ -2882,7 +2809,6 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo sal_Int32 nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT; // sdb.RowSet Properties - // registerProperty(PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, PropertyAttribute::READONLY, &m_aDataSourceName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, &rParent.m_aActiveConnection, ::getCppuType(reinterpret_cast< Reference< XConnection >* >(NULL))); registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::READONLY, &m_nResultSetConcurrency,::getCppuType(reinterpret_cast< sal_Int32*>(NULL))); registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY, &m_nResultSetType, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL))); @@ -2891,19 +2817,18 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo registerProperty(PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, nRT, &m_bIsBookmarable, ::getBooleanCppuType()); } -//-------------------------------------------------------------------------- ORowSetClone::~ORowSetClone() { DBG_DTOR(ORowSetClone, NULL); } + // com::sun::star::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > ORowSetClone::getTypes() throw (RuntimeException) { return ::comphelper::concatSequences(OSubComponent::getTypes(),ORowSetBase::getTypes()); } + // com::sun::star::XInterface -//-------------------------------------------------------------------------- Any ORowSetClone::queryInterface( const Type & rType ) throw (RuntimeException) { Any aRet = ORowSetBase::queryInterface(rType); @@ -2911,32 +2836,28 @@ Any ORowSetClone::queryInterface( const Type & rType ) throw (RuntimeException) aRet = OSubComponent::queryInterface(rType); return aRet; } -//------------------------------------------------------------------------------ + void ORowSetClone::acquire() throw() { OSubComponent::acquire(); } -//------------------------------------------------------------------------------ void ORowSetClone::release() throw() { OSubComponent::release(); } // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString ORowSetClone::getImplementationName( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.ORowSetClone"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ORowSetClone")); } -//------------------------------------------------------------------------------ sal_Bool ORowSetClone::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ORowSetClone::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); @@ -2946,7 +2867,6 @@ Sequence< ::rtl::OUString > ORowSetClone::getSupportedServiceNames( ) throw (Ru } // OComponentHelper -//------------------------------------------------------------------------------ void ORowSetClone::disposing() { MutexGuard aGuard( m_aMutex ); @@ -2958,7 +2878,6 @@ void ORowSetClone::disposing() } // XCloseable -//------------------------------------------------------------------------------ void ORowSetClone::close(void) throw( SQLException, RuntimeException ) { { @@ -2968,7 +2887,6 @@ void ORowSetClone::close(void) throw( SQLException, RuntimeException ) } dispose(); } -// ------------------------------------------------------------------------- // comphelper::OPropertyArrayUsageHelper ::cppu::IPropertyArrayHelper* ORowSetClone::createArrayHelper( ) const @@ -2977,7 +2895,6 @@ void ORowSetClone::close(void) throw( SQLException, RuntimeException ) describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); } -// ------------------------------------------------------------------------- // cppu::OPropertySetHelper ::cppu::IPropertyArrayHelper& SAL_CALL ORowSetClone::getInfoHelper() @@ -2985,8 +2902,7 @@ void ORowSetClone::close(void) throw( SQLException, RuntimeException ) typedef ::comphelper::OPropertyArrayUsageHelper<ORowSetClone> ORowSetClone_PROP; return *ORowSetClone_PROP::getArrayHelper(); } -// ------------------------------------------------------------------------- -//-------------------------------------------------------------------------- + Sequence< sal_Int8 > ORowSetClone::getUnoTunnelImplementationId() { static ::cppu::OImplementationId * pId = 0; @@ -3001,7 +2917,7 @@ Sequence< sal_Int8 > ORowSetClone::getUnoTunnelImplementationId() } return pId->getImplementationId(); } -// ----------------------------------------------------------------------------- + // com::sun::star::XUnoTunnel sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { @@ -3010,7 +2926,7 @@ sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId ) return 0; } -// ----------------------------------------------------------------------------- + void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) { if ( nHandle == PROPERTY_ID_FETCHSIZE ) @@ -3022,46 +2938,40 @@ void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,c OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue); } -// ----------------------------------------------------------------------------- void ORowSetClone::doCancelModification( ) { - //OSL_ENSURE( sal_False, "ORowSetClone::doCancelModification: invalid call!" ); } -// ----------------------------------------------------------------------------- sal_Bool ORowSetClone::isModification( ) { return sal_False; } -// ----------------------------------------------------------------------------- sal_Bool ORowSetClone::isModified( ) { return sal_False; } -// ----------------------------------------------------------------------------- sal_Bool ORowSetClone::isNew( ) { return sal_False; } -// ------------------------------------------------------------------------- void SAL_CALL ORowSetClone::execute( ) throw(SQLException, RuntimeException) { throwFunctionNotSupportedException( "RowSetClone::XRowSet::execute", *this ); } -// ------------------------------------------------------------------------- void SAL_CALL ORowSetClone::addRowSetListener( const Reference< XRowSetListener >& ) throw(RuntimeException) { throwFunctionNotSupportedException( "RowSetClone::XRowSet", *this ); } -// ------------------------------------------------------------------------- void SAL_CALL ORowSetClone::removeRowSetListener( const Reference< XRowSetListener >& ) throw(RuntimeException) { throwFunctionNotSupportedException( "RowSetClone::XRowSet", *this ); } } // dbaccess + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index fdd0ecb85..d4b92170a 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -99,8 +100,8 @@ namespace dbaccess */ ORowSetValueVector m_aPrematureParamValues; ORowSetValueVector m_aParameterValueForCache; - ::std::bit_vector m_aParametersSet; - ::std::bit_vector m_aReadOnlyDataColumns; + ::std::vector<bool> m_aParametersSet; + ::std::vector<bool> m_aReadOnlyDataColumns; ::cppu::OInterfaceContainerHelper m_aRowsetListeners; ::cppu::OInterfaceContainerHelper m_aApproveListeners; @@ -145,6 +146,7 @@ namespace dbaccess sal_Bool m_bNew ; sal_Bool m_bCanUpdateInsertedRows; sal_Bool m_bOwnConnection; + sal_Bool m_bPropChangeNotifyEnabled; private: /** builds m_aActiveCommand from our settings @@ -177,7 +179,7 @@ namespace dbaccess m_xActiveConnection points to a valid SDB-level connection @throws com::sun::star::sdb::SQLException - if an database-related error occured + if an database-related error occurred @throws com::sun::star::uno::RuntimeException if any of the components involved throws a com::sun::star::uno::RuntimeException @@ -248,6 +250,7 @@ namespace dbaccess virtual sal_Bool isModification( ); virtual sal_Bool isModified( ); virtual sal_Bool isNew( ); + virtual sal_Bool isPropertyChangeNotificationEnabled() const; virtual ~ORowSet(); @@ -542,3 +545,4 @@ namespace dbaccess } #endif // DBACCESS_CORE_API_ROWSET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 97719fc36..81fbd93ea 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,7 +71,6 @@ namespace dbaccess // ========================================================================= // = OEmptyCollection // ========================================================================= -// ------------------------------------------------------------------------- class OEmptyCollection : public sdbcx::OCollection { protected: @@ -79,22 +79,21 @@ protected: public: OEmptyCollection(::cppu::OWeakObject& _rParent,::osl::Mutex& _rMutex) : OCollection(_rParent,sal_True,_rMutex,::std::vector< ::rtl::OUString>()){} }; -// ----------------------------------------------------------------------------- + void OEmptyCollection::impl_refresh() throw(RuntimeException) { } -// ----------------------------------------------------------------------------- + connectivity::sdbcx::ObjectType OEmptyCollection::createObject(const ::rtl::OUString& /*_rName*/) { return connectivity::sdbcx::ObjectType(); } -// ----------------------------------------------------------------------------- // ========================================================================= // = ORowSetBase // ========================================================================= DBG_NAME(ORowSetBase) -// ------------------------------------------------------------------------- + ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cppu::OBroadcastHelper& _rBHelper, ::osl::Mutex* _pMutex ) :OPropertyStateContainer(_rBHelper) ,m_pMutex(_pMutex) @@ -124,7 +123,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp registerPropertyNoMember( PROPERTY_ROWCOUNT, PROPERTY_ID_ROWCOUNT, nRBT, ::getCppuType( &nInitialRowCountValue ), &nInitialRowCountValue ); registerPropertyNoMember( PROPERTY_ISROWCOUNTFINAL, PROPERTY_ID_ISROWCOUNTFINAL, nRBT, ::getBooleanCppuType(), &bInitialRowCountFinalValue ); } -// ----------------------------------------------------------------------------- + ORowSetBase::~ORowSetBase() { if(m_pColumns) @@ -141,15 +140,15 @@ ORowSetBase::~ORowSetBase() DBG_DTOR(ORowSetBase,NULL); } + // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > ORowSetBase::getTypes() throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getTypes" ); return ::comphelper::concatSequences(ORowSetBase_BASE::getTypes(),OPropertyStateContainer::getTypes()); } + // com::sun::star::uno::XInterface -//-------------------------------------------------------------------------- Any ORowSetBase::queryInterface( const Type & rType ) throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::queryInterface" ); @@ -158,7 +157,7 @@ Any ORowSetBase::queryInterface( const Type & rType ) throw (RuntimeException) aRet = OPropertyStateContainer::queryInterface(rType); return aRet; } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSetBase::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getFastPropertyValue" ); @@ -179,7 +178,7 @@ void SAL_CALL ORowSetBase::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) c else OPropertyStateContainer::getFastPropertyValue(rValue,nHandle); } -// ------------------------------------------------------------------------- + // OComponentHelper void SAL_CALL ORowSetBase::disposing(void) { @@ -198,7 +197,7 @@ void SAL_CALL ORowSetBase::disposing(void) } m_pCache = NULL; } -// ------------------------------------------------------------------------- + // comphelper::OPropertyArrayUsageHelper ::cppu::IPropertyArrayHelper* ORowSetBase::createArrayHelper( ) const { @@ -207,14 +206,14 @@ void SAL_CALL ORowSetBase::disposing(void) describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); } -// ------------------------------------------------------------------------- + // cppu::OPropertySetHelper ::cppu::IPropertyArrayHelper& SAL_CALL ORowSetBase::getInfoHelper() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getInfoHelper" ); return *const_cast<ORowSetBase*>(this)->getArrayHelper(); } -// ------------------------------------------------------------------------- + // XRow sal_Bool SAL_CALL ORowSetBase::wasNull( ) throw(SQLException, RuntimeException) { @@ -223,27 +222,26 @@ sal_Bool SAL_CALL ORowSetBase::wasNull( ) throw(SQLException, RuntimeException) checkCache(); return impl_wasNull(); } -// ----------------------------------------------------------------------------- + sal_Bool ORowSetBase::impl_wasNull() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_wasNull" ); - return ((m_nLastColumnIndex != -1) && !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid()) ? ((*m_aCurrentRow)->get())[m_nLastColumnIndex].isNull() : sal_True; + return ((m_nLastColumnIndex != -1) && !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is()) ? ((*m_aCurrentRow)->get())[m_nLastColumnIndex].isNull() : sal_True; } -// ----------------------------------------------------------------------------- const ORowSetValue& ORowSetBase::getValue(sal_Int32 columnIndex) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getValue" ); checkCache(); return impl_getValue(columnIndex); } -// ----------------------------------------------------------------------------- + const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) -{ +{ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_getValue" ); if ( m_bBeforeFirst || m_bAfterLast ) { - OSL_ENSURE(0,"ORowSetBase::getValue: Illegal call here (we're before first or after last)!"); + OSL_FAIL("ORowSetBase::getValue: Illegal call here (we're before first or after last)!"); ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); } @@ -252,7 +250,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) return m_aEmptyValue; } - bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); + bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() ); if ( !bValidCurrentRow ) { // currentrow is null when the clone moves the window @@ -261,7 +259,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null."); - bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); + bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() ); } if ( bValidCurrentRow ) @@ -278,14 +276,14 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) ORowSetMatrix::iterator k = aHelper.aIterator; for (; k != m_pCache->getEnd(); ++k) { - ORowSetValueVector* pTemp = k->getBodyPtr(); + ORowSetValueVector* pTemp = k->get(); OSL_ENSURE( pTemp != (void*)0xfeeefeee,"HALT!" ); } #endif OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow < m_pCache->getEnd() && aCacheIter != m_pCache->m_aCacheIterators.end(),"Invalid iterator set for currentrow!"); #if OSL_DEBUG_LEVEL > 0 ORowSetRow rRow = (*m_aCurrentRow); - OSL_ENSURE(rRow.isValid() && static_cast<sal_uInt16>(columnIndex) < (rRow->get()).size(),"Invalid size of vector!"); + OSL_ENSURE(rRow.is() && static_cast<sal_uInt16>(columnIndex) < (rRow->get()).size(),"Invalid size of vector!"); #endif return ((*m_aCurrentRow)->get())[m_nLastColumnIndex = columnIndex]; } @@ -293,100 +291,100 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) // we should normally never reach this return m_aEmptyValue; } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL ORowSetBase::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getString" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBoolean" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int8 SAL_CALL ORowSetBase::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getByte" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int16 SAL_CALL ORowSetBase::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getShort" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL ORowSetBase::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getInt" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + sal_Int64 SAL_CALL ORowSetBase::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getLong" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + float SAL_CALL ORowSetBase::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getFloat" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + double SAL_CALL ORowSetBase::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getDouble" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + Sequence< sal_Int8 > SAL_CALL ORowSetBase::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBytes" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Date SAL_CALL ORowSetBase::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getDate" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::Time SAL_CALL ORowSetBase::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getTime" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + ::com::sun::star::util::DateTime SAL_CALL ORowSetBase::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getTimestamp" ); ::osl::MutexGuard aGuard( *m_pMutex ); return getValue(columnIndex); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBinaryStream" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - + if ( m_bBeforeFirst || m_bAfterLast ) { - OSL_ENSURE(0,"ORowSetBase::getBinaryStream: Illegal call here (we're before first or after last)!"); + OSL_FAIL("ORowSetBase::getBinaryStream: Illegal call here (we're before first or after last)!"); ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); } @@ -395,7 +393,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS return NULL; } - bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); + bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() ); if ( !bValidCurrentRow ) { positionCache( MOVE_NONE_REFRESH_ONLY ); @@ -403,7 +401,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null."); - bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() ); + bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() ); } if ( bValidCurrentRow ) @@ -412,13 +410,13 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS // we should normally never reach this return Reference< ::com::sun::star::io::XInputStream >(); } -// ------------------------------------------------------------------------- + Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getCharacterStream" ); return getBinaryStream(columnIndex); } -// ------------------------------------------------------------------------- + Any SAL_CALL ORowSetBase::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getObject" ); @@ -427,42 +425,42 @@ Any SAL_CALL ORowSetBase::getObject( sal_Int32 columnIndex, const Reference< XNa return getValue(columnIndex).makeAny(); } -// ------------------------------------------------------------------------- + Reference< XRef > SAL_CALL ORowSetBase::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getRef" ); ::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *m_pMySelf ); return NULL; } -// ------------------------------------------------------------------------- + Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBlob" ); return Reference< XBlob >(getValue(columnIndex).makeAny(),UNO_QUERY); } -// ------------------------------------------------------------------------- + Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getClob" ); return Reference< XClob >(getValue(columnIndex).makeAny(),UNO_QUERY); } -// ------------------------------------------------------------------------- + Reference< XArray > SAL_CALL ORowSetBase::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getArray" ); ::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *m_pMySelf ); return NULL; } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XRowLocate Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBookmark" ); - DBG_TRACE2("DBACCESS ORowSetBase::getBookmark() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::getBookmark() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - + if ( m_bBeforeFirst || m_bAfterLast ) ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); @@ -472,20 +470,20 @@ Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::getBookmark: bookmark has no value!" ); return m_aBookmark; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::moveToBookmark" ); - DBG_TRACE2("DBACCESS ORowSetBase::moveToBookmark(Any) Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::moveToBookmark(Any) Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(bookmark.hasValue(),"ORowSetBase::moveToBookmark bookmark has no value!"); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); if(!bookmark.hasValue() || m_nResultSetType == ResultSetType::FORWARD_ONLY) { if(bookmark.hasValue()) - OSL_ENSURE(0,"MoveToBookmark is not possible when we are only forward"); + OSL_FAIL("MoveToBookmark is not possible when we are only forward"); else - OSL_ENSURE(0,"Bookmark is not valid"); + OSL_FAIL("Bookmark is not valid"); throwFunctionSequenceException(*m_pMySelf); } @@ -521,14 +519,14 @@ sal_Bool SAL_CALL ORowSetBase::moveToBookmark( const Any& bookmark ) throw(SQLEx // - IsNew aNotifier.fire( ); } - DBG_TRACE2("DBACCESS ORowSetBase::moveToBookmark(Any) = %i Clone = %i\n",bRet,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::moveToBookmark(Any) = %i Clone = %i\n",bRet,m_bClone); return bRet; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::moveRelativeToBookmark" ); - DBG_TRACE2("DBACCESS ORowSetBase::moveRelativeToBookmark(Any,%i) Clone = %i\n",rows,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::moveRelativeToBookmark(Any,%i) Clone = %i\n",rows,m_bClone); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -565,10 +563,10 @@ sal_Bool SAL_CALL ORowSetBase::moveRelativeToBookmark( const Any& bookmark, sal_ // RowCount/IsRowCountFinal fireRowcount(); } - DBG_TRACE3("DBACCESS ORowSetBase::moveRelativeToBookmark(Any,%i) = %i Clone = %i\n",rows,bRet,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::moveRelativeToBookmark(Any,%i) = %i Clone = %i\n",rows,bRet,m_bClone); return bRet; } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL ORowSetBase::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::compareBookmarks" ); @@ -576,7 +574,7 @@ sal_Int32 SAL_CALL ORowSetBase::compareBookmarks( const Any& _first, const Any& checkCache(); return m_pCache->compareBookmarks(_first,_second); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::hasOrderedBookmarks" ); @@ -584,7 +582,7 @@ sal_Bool SAL_CALL ORowSetBase::hasOrderedBookmarks( ) throw(SQLException, Runti checkCache(); return m_pCache->hasOrderedBookmarks(); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL ORowSetBase::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::hashBookmark" ); @@ -592,8 +590,7 @@ sal_Int32 SAL_CALL ORowSetBase::hashBookmark( const Any& bookmark ) throw(SQLExc checkCache(); return m_pCache->hashBookmark(bookmark); } -// ------------------------------------------------------------------------- -// ------------------------------------------------------------------------- + // XResultSetMetaDataSupplier Reference< XResultSetMetaData > SAL_CALL ORowSetBase::getMetaData( ) throw(SQLException, RuntimeException) { @@ -606,7 +603,6 @@ Reference< XResultSetMetaData > SAL_CALL ORowSetBase::getMetaData( ) throw(SQLE return xMeta; } -// ------------------------------------------------------------------------- // XColumnLocate sal_Int32 SAL_CALL ORowSetBase::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) @@ -615,10 +611,9 @@ sal_Int32 SAL_CALL ORowSetBase::findColumn( const ::rtl::OUString& columnName ) ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aColumnsMutex ); - // it is possible to save some time her when we remember the names - position relation in a map + // it is possible to save some time here when we remember the names - position relation in a map return m_pColumns ? m_pColumns->findColumn(columnName) : sal_Int32(0); } -// ------------------------------------------------------------------------- // ::com::sun::star::sdbcx::XColumnsSupplier Reference< XNameAccess > SAL_CALL ORowSetBase::getColumns( ) throw(RuntimeException) @@ -636,12 +631,12 @@ Reference< XNameAccess > SAL_CALL ORowSetBase::getColumns( ) throw(RuntimeExcep return m_pColumns; } -// ------------------------------------------------------------------------- + // XResultSet sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::next" ); - DBG_TRACE2("DBACCESS ORowSetBase::next() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::next() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkCache(); @@ -660,7 +655,6 @@ sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException) sal_Bool bAfterLast = m_pCache->isAfterLast(); bRet = m_pCache->next(); doCancelModification( ); - if ( bRet || bAfterLast != m_pCache->isAfterLast() ) { @@ -684,10 +678,10 @@ sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException) // - RowCount/IsRowCountFinal fireRowcount(); } - DBG_TRACE3("DBACCESS ORowSetBase::next() = %i Clone = %i ID = %i\n",bRet,m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::next() = %i Clone = %i ID = %i\n",bRet,m_bClone,osl_getThreadIdentifier(NULL)); return bRet; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::isBeforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isBeforeFirst" ); @@ -695,32 +689,32 @@ sal_Bool SAL_CALL ORowSetBase::isBeforeFirst( ) throw(SQLException, RuntimeExce ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - DBG_TRACE2("DBACCESS ORowSetBase::isBeforeFirst() = %i Clone = %i\n",m_bBeforeFirst,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::isBeforeFirst() = %i Clone = %i\n",m_bBeforeFirst,m_bClone); return m_bBeforeFirst; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::isAfterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isAfterLast" ); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - DBG_TRACE2("DBACCESS ORowSetBase::isAfterLast() = %i Clone = %i\n",m_bAfterLast,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::isAfterLast() = %i Clone = %i\n",m_bAfterLast,m_bClone); return m_bAfterLast; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetBase::isOnFirst() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isOnFirst" ); return isFirst(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::isFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isFirst" ); - DBG_TRACE2("DBACCESS ORowSetBase::isFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::isFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); @@ -735,20 +729,20 @@ sal_Bool SAL_CALL ORowSetBase::isFirst( ) throw(SQLException, RuntimeException) positionCache( MOVE_NONE_REFRESH_ONLY ); sal_Bool bIsFirst = m_pCache->isFirst(); - DBG_TRACE2("DBACCESS ORowSetBase::isFirst() = %i Clone = %i\n",bIsFirst,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::isFirst() = %i Clone = %i\n",bIsFirst,m_bClone); return bIsFirst; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetBase::isOnLast() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isOnLast" ); return isLast(); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::isLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::isLast" ); - DBG_TRACE2("DBACCESS ORowSetBase::isLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::isLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); @@ -767,14 +761,14 @@ sal_Bool SAL_CALL ORowSetBase::isLast( ) throw(SQLException, RuntimeException) positionCache( MOVE_NONE_REFRESH_ONLY ); sal_Bool bIsLast = m_pCache->isLast(); - DBG_TRACE2("DBACCESS ORowSetBase::isLast() = %i Clone = %i\n",bIsLast,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::isLast() = %i Clone = %i\n",bIsLast,m_bClone); return bIsLast; } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSetBase::beforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::beforeFirst" ); - DBG_TRACE2("DBACCESS ORowSetBase::beforeFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::beforeFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -810,13 +804,13 @@ void SAL_CALL ORowSetBase::beforeFirst( ) throw(SQLException, RuntimeException) // to be done _after_ the notifications! m_aOldRow->clearRow(); } - DBG_TRACE2("DBACCESS ORowSetBase::beforeFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::beforeFirst() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSetBase::afterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::afterLast" ); - DBG_TRACE2("DBACCESS ORowSetBase::afterLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::afterLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -850,14 +844,14 @@ void SAL_CALL ORowSetBase::afterLast( ) throw(SQLException, RuntimeException) fireRowcount(); } } - DBG_TRACE2("DBACCESS ORowSetBase::afterLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::afterLast() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::move( ::std::mem_fun_t<sal_Bool,ORowSetBase>& _aCheckFunctor, ::std::mem_fun_t<sal_Bool,ORowSetCache>& _aMovementFunctor) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::move" ); - DBG_TRACE2("DBACCESS ORowSetBase::move() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::move() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); @@ -897,40 +891,40 @@ sal_Bool SAL_CALL ORowSetBase::move( ::std::mem_fun_t<sal_Bool,ORowSetBase>& _aC // - RowCount/IsRowCountFinal fireRowcount(); } - DBG_TRACE2("DBACCESS ORowSetBase::move() = %i Clone = %i\n",bRet,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::move() = %i Clone = %i\n",bRet,m_bClone); return bRet; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::first( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::first" ); - DBG_TRACE2("DBACCESS ORowSetBase::first() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::first() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::std::mem_fun_t<sal_Bool,ORowSetBase> ioF_tmp(&ORowSetBase::isOnFirst); ::std::mem_fun_t<sal_Bool,ORowSetCache> F_tmp(&ORowSetCache::first); return move(ioF_tmp,F_tmp); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::last( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::last" ); - DBG_TRACE2("DBACCESS ORowSetBase::last() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::last() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::std::mem_fun_t<sal_Bool,ORowSetBase> ioL_tmp(&ORowSetBase::isOnLast); ::std::mem_fun_t<sal_Bool,ORowSetCache> L_tmp(&ORowSetCache::last); return move(ioL_tmp,L_tmp); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL ORowSetBase::getRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getRow" ); - DBG_TRACE2("DBACCESS ORowSetBase::getRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::getRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::osl::MutexGuard aGuard( *m_pMutex ); - + checkCache(); return impl_getRow(); } -// ------------------------------------------------------------------------- + sal_Int32 ORowSetBase::impl_getRow() -{ +{ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_getRow" ); sal_Int32 nPos = 0; if ( m_bBeforeFirst ) @@ -952,14 +946,14 @@ sal_Int32 ORowSetBase::impl_getRow() } nPos = m_pCache->getRow(); } - DBG_TRACE3("DBACCESS ORowSetBase::impl_getRow() = %i Clone = %i ID = %i\n",nPos,m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::impl_getRow() = %i Clone = %i ID = %i\n",nPos,m_bClone,osl_getThreadIdentifier(NULL)); return nPos; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::absolute" ); - DBG_TRACE2("DBACCESS ORowSetBase::absolute(%i) Clone = %i\n",row,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::absolute(%i) Clone = %i\n",row,m_bClone); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); @@ -998,14 +992,14 @@ sal_Bool SAL_CALL ORowSetBase::absolute( sal_Int32 row ) throw(SQLException, Run // - RowCount/IsRowCountFinal fireRowcount(); } - DBG_TRACE3("DBACCESS ORowSetBase::absolute(%i) = %i Clone = %i\n",row,bRet,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::absolute(%i) = %i Clone = %i\n",row,bRet,m_bClone); return bRet; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::relative" ); - DBG_TRACE2("DBACCESS ORowSetBase::relative(%i) Clone = %i\n",rows,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::relative(%i) Clone = %i\n",rows,m_bClone); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1054,14 +1048,14 @@ sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows ) throw(SQLException, Ru // - RowCount/IsRowCountFinal fireRowcount(); } - DBG_TRACE3("DBACCESS ORowSetBase::relative(%i) = %i Clone = %i\n",rows,bRet,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::relative(%i) = %i Clone = %i\n",rows,bRet,m_bClone); return bRet; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::previous( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::previous" ); - DBG_TRACE2("DBACCESS ORowSetBase::previous() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::previous() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); ::connectivity::checkDisposed(m_rBHelper.bDisposed); ::osl::ResettableMutexGuard aGuard( *m_pMutex ); @@ -1094,7 +1088,7 @@ sal_Bool SAL_CALL ORowSetBase::previous( ) throw(SQLException, RuntimeException } else { - DBG_ERROR( "ORowSetBase::previous: inconsistency!" ); + OSL_FAIL( "ORowSetBase::previous: inconsistency!" ); // we should never reach this place, as we should not get into this whole branch if m_bBeforeFirst // was |true| from the beginning movementFailed(); @@ -1107,17 +1101,16 @@ sal_Bool SAL_CALL ORowSetBase::previous( ) throw(SQLException, RuntimeException // - RowCount/IsRowCountFinal fireRowcount(); } - DBG_TRACE2("DBACCESS ORowSetBase::previous() = %i Clone = %i\n",bRet,m_bClone); + OSL_TRACE("DBACCESS ORowSetBase::previous() = %i Clone = %i\n",bRet,m_bClone); return bRet; } -// ----------------------------------------------------------------------------- + void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::setCurrentRow" ); - DBG_TRACE2("DBACCESS ORowSetBase::setCurrentRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::setCurrentRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); m_bBeforeFirst = m_pCache->isBeforeFirst(); m_bAfterLast = m_pCache->isAfterLast(); - //m_pCache->resetInsertRow(sal_True); if(!(m_bBeforeFirst || m_bAfterLast)) { @@ -1128,7 +1121,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is null!"); m_aCurrentRow.setBookmark(m_aBookmark); OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd(),"Position of matrix iterator isn't valid!"); - OSL_ENSURE(m_aCurrentRow->isValid(),"Currentrow isn't valid"); + OSL_ENSURE(m_aCurrentRow->is(),"Currentrow isn't valid"); OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!"); #if OSL_DEBUG_LEVEL > 0 @@ -1144,10 +1137,9 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!"); #if OSL_DEBUG_LEVEL > 0 ORowSetRow rRow = (*m_aCurrentRow); - OSL_ENSURE(rRow.isValid() ,"Invalid size of vector!"); + OSL_ENSURE(rRow.is() ,"Invalid size of vector!"); #endif // the cache could repositioned so we need to adjust the cache - // #104144# OJ if ( _bMoved && m_aCurrentRow.isNull() ) { positionCache( MOVE_NONE_REFRESH_ONLY ); @@ -1170,29 +1162,29 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR firePropertyChange(_rOldValues); // TODO: can this be done before the notifications? - if(!(m_bBeforeFirst || m_bAfterLast) && !m_aCurrentRow.isNull() && m_aCurrentRow->isValid() && m_aCurrentRow != m_pCache->getEnd()) - m_aOldRow->setRow(new ORowSetValueVector(m_aCurrentRow->getBody())); + if(!(m_bBeforeFirst || m_bAfterLast) && !m_aCurrentRow.isNull() && m_aCurrentRow->is() && m_aCurrentRow != m_pCache->getEnd()) + m_aOldRow->setRow(new ORowSetValueVector( *(*m_aCurrentRow) )); if ( _bMoved && _bDoNotify ) // - cursorMoved notifyAllListenersCursorMoved( _rGuard ); - DBG_TRACE2("DBACCESS ORowSetBase::setCurrentRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::setCurrentRow() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } -// ----------------------------------------------------------------------------- + void ORowSetBase::checkPositioningAllowed() throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::checkPositioningAllowed" ); if(!m_pCache || m_nResultSetType == ResultSetType::FORWARD_ONLY) throwFunctionSequenceException(*m_pMySelf); } -//------------------------------------------------------------------------------ + Reference< XInterface > ORowSetBase::getStatement(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getStatement" ); return NULL; } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSetBase::refreshRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::refreshRow" ); @@ -1211,32 +1203,32 @@ void SAL_CALL ORowSetBase::refreshRow( ) throw(SQLException, RuntimeException) firePropertyChange(aOldValues); } } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::rowUpdated( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::rowUpdated" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - + if ( impl_rowDeleted() ) return sal_False; return m_pCache->rowUpdated(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::rowInserted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::rowInserted" ); ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); - + if ( impl_rowDeleted() ) return sal_False; return m_pCache->rowInserted(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL ORowSetBase::rowDeleted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::rowDeleted" ); @@ -1244,12 +1236,12 @@ sal_Bool SAL_CALL ORowSetBase::rowDeleted( ) throw(SQLException, RuntimeExcepti checkCache(); return impl_rowDeleted(); } -// ------------------------------------------------------------------------- + sal_Bool ORowSetBase::impl_rowDeleted( ) { return !m_aBookmark.hasValue() && !m_bBeforeFirst && !m_bAfterLast; } -// ------------------------------------------------------------------------- + // XWarningsSupplier Any SAL_CALL ORowSetBase::getWarnings( ) throw(SQLException, RuntimeException) { @@ -1265,7 +1257,7 @@ Any SAL_CALL ORowSetBase::getWarnings( ) throw(SQLException, RuntimeException) return Any(); } -// ------------------------------------------------------------------------- + void SAL_CALL ORowSetBase::clearWarnings( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::clearWarnings" ); @@ -1278,11 +1270,14 @@ void SAL_CALL ORowSetBase::clearWarnings( ) throw(SQLException, RuntimeExceptio xWarnings->clearWarnings(); } } -// ------------------------------------------------------------------------- + void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow) { + if (!isPropertyChangeNotificationEnabled()) + return; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::firePropertyChange" ); - DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(m_pColumns,"Columns can not be NULL here!"); #if OSL_DEBUG_LEVEL > 1 sal_Bool bNull; @@ -1294,47 +1289,48 @@ void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow) try { TDataColumns::iterator aEnd = m_aDataColumns.end(); - for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != aEnd;++aIter,++i) // #104278# OJ ++i inserted - (*aIter)->fireValueChange(_rOldRow.isValid() ? (_rOldRow->get())[i+1] : ::connectivity::ORowSetValue()); + for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != aEnd;++aIter,++i) + (*aIter)->fireValueChange(_rOldRow.is() ? (_rOldRow->get())[i+1] : ::connectivity::ORowSetValue()); } catch(Exception&) { - OSL_ENSURE(0,"firePropertyChange: Exception"); + OSL_FAIL("firePropertyChange: Exception"); } - DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } -// ------------------------------------------------------------------------- + void ORowSetBase::firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rOldValue) { OSL_ENSURE(_nPos < (sal_Int32)m_aDataColumns.size(),"nPos is invalid!"); m_aDataColumns[_nPos]->fireValueChange(_rOldValue); } -// ----------------------------------------------------------------------------- + void ORowSetBase::fireRowcount() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::fireRowcount" ); } -// ----------------------------------------------------------------------------- sal_Bool ORowSetBase::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& /*_rGuard*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::notifyAllListenersCursorBeforeMove" ); return sal_True; } -// ----------------------------------------------------------------------------- void ORowSetBase::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& /*_rGuard*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::notifyAllListenersCursorMoved" ); } -// ----------------------------------------------------------------------------- void ORowSetBase::notifyAllListeners(::osl::ResettableMutexGuard& /*_rGuard*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::notifyAllListeners" ); } -// ----------------------------------------------------------------------------- +sal_Bool ORowSetBase::isPropertyChangeNotificationEnabled() const +{ + return sal_True; +} + void ORowSetBase::fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::fireProperty" ); @@ -1343,11 +1339,10 @@ void ORowSetBase::fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _ fire( &_nProperty, &aNew, &aOld, 1, sal_False ); } -// ----------------------------------------------------------------------------- void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::positionCache" ); - DBG_TRACE2("DBACCESS ORowSetBase::positionCache() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::positionCache() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); sal_Bool bSuccess = sal_False; if ( m_aBookmark.hasValue() ) @@ -1396,10 +1391,11 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection ) } } OSL_ENSURE( bSuccess, "ORowSetBase::positionCache: failed!" ); + (void)bSuccess; - DBG_TRACE2("DBACCESS ORowSetBase::positionCache() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::positionCache() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } -// ----------------------------------------------------------------------------- + void ORowSetBase::checkCache() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::checkCache" ); @@ -1407,11 +1403,11 @@ void ORowSetBase::checkCache() if(!m_pCache) throwFunctionSequenceException(*m_pMySelf); } -// ----------------------------------------------------------------------------- + void ORowSetBase::movementFailed() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::movementFailed" ); - DBG_TRACE2("DBACCESS ORowSetBase::movementFailed() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::movementFailed() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); m_aOldRow->clearRow(); m_aCurrentRow = m_pCache->getEnd(); m_bBeforeFirst = m_pCache->isBeforeFirst(); @@ -1419,25 +1415,25 @@ void ORowSetBase::movementFailed() m_aBookmark = Any(); m_aCurrentRow.setBookmark(m_aBookmark); OSL_ENSURE(m_bBeforeFirst || m_bAfterLast,"BeforeFirst or AfterLast is wrong!"); - DBG_TRACE2("DBACCESS ORowSetBase::movementFailed() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); + OSL_TRACE("DBACCESS ORowSetBase::movementFailed() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); } -// ----------------------------------------------------------------------------- + ORowSetRow ORowSetBase::getOldRow(sal_Bool _bWasNew) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getOldRow" ); - OSL_ENSURE(m_aOldRow.isValid(),"RowSetRowHElper isn't valid!"); + OSL_ENSURE(m_aOldRow.is(),"RowSetRowHElper isn't valid!"); ORowSetRow aOldValues; - if ( !_bWasNew && m_aOldRow->getRow().isValid() ) - aOldValues = new ORowSetValueVector( m_aOldRow->getRow().getBody()); // remember the old values + if ( !_bWasNew && m_aOldRow->getRow().is() ) + aOldValues = new ORowSetValueVector( *(m_aOldRow->getRow())); // remember the old values return aOldValues; } -// ----------------------------------------------------------------------------- + void ORowSetBase::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getPropertyDefaultByHandle" ); _rDefault.clear(); } -// ----------------------------------------------------------------------------- + void ORowSetBase::onDeleteRow( const Any& _rBookmark ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::onDeleteRow" ); @@ -1453,7 +1449,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark ) m_nDeletedPosition = m_pCache->getRow(); } } -// ----------------------------------------------------------------------------- + void ORowSetBase::onDeletedRow( const Any& _rBookmark, sal_Int32 _nPos ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::onDeletedRow" ); @@ -1476,7 +1472,7 @@ void ORowSetBase::onDeletedRow( const Any& _rBookmark, sal_Int32 _nPos ) m_aCurrentRow.setBookmark( m_aBookmark ); } } -// ----------------------------------------------------------------------------- + sal_Int32 ORowSetBase::impl_getRowCount() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::impl_getRowCount" ); @@ -1494,7 +1490,7 @@ struct ORowSetNotifierImpl }; DBG_NAME(ORowSetNotifier) -// ----------------------------------------------------------------------------- + ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet ) :m_pRowSet( _pRowSet ) ,m_bWasNew( sal_False ) @@ -1515,7 +1511,7 @@ ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet ) if ( m_pRowSet->isModification( ORowSetBase::GrantNotifierAccess() ) ) m_pRowSet->doCancelModification( ORowSetBase::GrantNotifierAccess() ); } -// ----------------------------------------------------------------------------- + ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet,const ORowSetValueVector::Vector& i_aRow ) :m_pImpl(new ORowSetNotifierImpl) ,m_pRowSet( _pRowSet ) @@ -1530,14 +1526,13 @@ ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet,const ORowSetValueVector OSL_ENSURE( m_pRowSet, "ORowSetNotifier::ORowSetNotifier: invalid row set. This wil crash." ); m_pImpl->aRow = i_aRow; // yes, create a copy to store the old values } -// ----------------------------------------------------------------------------- + ORowSetNotifier::~ORowSetNotifier( ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetNotifier::~ORowSetNotifier" ); DBG_DTOR(ORowSetNotifier,NULL); } -// ----------------------------------------------------------------------------- void ORowSetNotifier::fire() { // we're not interested in firing changes FALSE->TRUE, only TRUE->FALSE. @@ -1557,19 +1552,19 @@ void ORowSetNotifier::fire() m_bNotifyCalled = sal_True; #endif } -// ----------------------------------------------------------------------------- + ::std::vector<sal_Int32>& ORowSetNotifier::getChangedColumns() const { OSL_ENSURE(m_pImpl.get(),"Illegal CTor call, use the other one!"); return m_pImpl->aChangedColumns; } -// ----------------------------------------------------------------------------- + ::std::vector<Any>& ORowSetNotifier::getChangedBookmarks() const { OSL_ENSURE(m_pImpl.get(),"Illegal CTor call, use the other one!"); return m_pImpl->aChangedBookmarks; } -// ----------------------------------------------------------------------------- + void ORowSetNotifier::firePropertyChange() { OSL_ENSURE(m_pImpl.get(),"Illegal CTor call, use the other one!"); @@ -1585,3 +1580,5 @@ void ORowSetNotifier::firePropertyChange() } } } // namespace dbaccess + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx index 62d778a56..5b1f0d08e 100644 --- a/dbaccess/source/core/api/RowSetBase.hxx +++ b/dbaccess/source/core/api/RowSetBase.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,76 +28,34 @@ #ifndef DBACCESS_CORE_API_ROWSETBASE_HXX #define DBACCESS_CORE_API_ROWSETBASE_HXX -#ifndef _CPPUHELPER_IMPLBASE10_HXX_ #include <cppuhelper/implbase10.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ #include <com/sun/star/sdbc/XColumnLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ #include <com/sun/star/sdbc/XCloseable.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ #include <com/sun/star/sdbcx/XRowLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ #include <com/sun/star/sdbc/XWarningsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> -#endif -#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ #include <cppuhelper/interfacecontainer.h> -#endif -#ifndef CONNECTIVITY_SQLERROR_HXX #include <connectivity/sqlerror.hxx> -#endif -#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #include <connectivity/CommonTools.hxx> -#endif -#ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX #include <comphelper/propertystatecontainer.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include <comphelper/proparrhlp.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_ #include <com/sun/star/sdbc/XRowSet.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ #include <com/sun/star/util/XNumberFormatTypes.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef DBACCESS_CORE_API_ROWSETROW_HXX #include "RowSetRow.hxx" -#endif -#ifndef _COMPHELPER_BROADCASTHELPER_HXX_ #include <comphelper/broadcasthelper.hxx> -#endif -#ifndef DBACCESS_ROWSETCACHEITERATOR_HXX #include "RowSetCacheIterator.hxx" -#endif #include "core_resource.hxx" #include <comphelper/componentcontext.hxx> #include <functional> -namespace com { namespace sun { namespace star { +namespace com { namespace sun { namespace star { namespace sdb { struct RowChangeEvent; } namespace lang { struct Locale; } } } } @@ -191,6 +150,9 @@ namespace dbaccess virtual sal_Bool isModified( ) = 0; // return <TRUE/> if and only if the current row is the insert row virtual sal_Bool isNew( ) = 0; + // return <TRUE/> if the property change notification should be fired + // upon property change. + virtual sal_Bool isPropertyChangeNotificationEnabled() const; // notify the change of a boolean property void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld ); @@ -229,7 +191,7 @@ namespace dbaccess const connectivity::ORowSetValue& getValue(sal_Int32 columnIndex); // the cache has to be checked before calling this method const connectivity::ORowSetValue& impl_getValue(sal_Int32 columnIndex); - // sets the current and the bookmark + // sets the current and the bookmark void setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard); void checkPositioningAllowed() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // checks if the cache is null @@ -413,7 +375,7 @@ namespace dbaccess // a method of ORowSetBase (or derivees) sal_Bool m_bWasNew; sal_Bool m_bWasModified; - + #ifdef DBG_UTIL sal_Bool m_bNotifyCalled; #endif @@ -455,10 +417,11 @@ namespace dbaccess */ ::std::vector<sal_Int32>& getChangedColumns() const; ::std::vector<com::sun::star::uno::Any>& getChangedBookmarks() const; - + }; } // end of namespace #endif // DBACCESS_CORE_API_ROWSETBASE_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 43b2f580e..364bfbfb5 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" - #include "BookmarkSet.hxx" #include "CRowSetColumn.hxx" #include "CRowSetDataColumn.hxx" @@ -42,7 +42,6 @@ #include "core_resource.hxx" #include "dbastrings.hrc" -/** === begin UNO includes === **/ #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbcx/CompareBookmark.hpp> @@ -51,7 +50,6 @@ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XKeysSupplier.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -/** === end UNO includes === **/ #include <comphelper/extract.hxx> #include <comphelper/property.hxx> @@ -64,6 +62,7 @@ #include <connectivity/sqlparse.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <osl/diagnose.h> #include <algorithm> @@ -83,7 +82,7 @@ using namespace ::osl; #define CHECK_MATRIX_POS(M) OSL_ENSURE(((M) >= static_cast<ORowSetMatrix::difference_type>(0)) && ((M) < static_cast<sal_Int32>(m_pMatrix->size())),"Position is invalid!") DBG_NAME(ORowSetCache) -// ------------------------------------------------------------------------- + ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, const Reference< XSingleSelectQueryAnalyzer >& _xAnalyzer, const ::comphelper::ComponentContext& _rContext, @@ -179,7 +178,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, OSL_ENSURE(xTabSup.is(),"ORowSet::execute composer isn't a tablesupplier!"); Reference<XNameAccess> xTables = xTabSup->getTables(); Sequence< ::rtl::OUString> aTableNames = xTables->getElementNames(); - if ( aTableNames.getLength() > 1 && !_rUpdateTableName.getLength() && bNeedKeySet ) + if ( aTableNames.getLength() > 1 && !_rUpdateTableName.getLength() && bNeedKeySet ) {// here we have a join or union and nobody told us which table to update, so we update them all m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount); @@ -195,7 +194,6 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, } catch(const Exception&) { - // DBG_UNHANDLED_EXCEPTION(); } m_pCacheSet = NULL; m_xCacheSet.clear(); @@ -273,13 +271,10 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, // need to check if we could handle this select clause bAllKeysFound = bAllKeysFound && (nTablesCount == 1 || checkJoin(xConnection,_xAnalyzer,aUpdateTableName)); - // || !(comphelper::hasProperty(PROPERTY_CANUPDATEINSERTEDROWS,xProp) && any2bool(xProp->getPropertyValue(PROPERTY_CANUPDATEINSERTEDROWS))) - - // oj removed because keyset uses only the next// || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY) if(!bAllKeysFound ) { if ( bBookmarkable ) - { + { // here I know that we have a read only bookmarable cursor _xRs->beforeFirst(); m_nPrivileges = Privilege::SELECT; @@ -366,7 +361,6 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, m_nPrivileges = Privilege::SELECT; } -// ------------------------------------------------------------------------- ORowSetCache::~ORowSetCache() { m_pCacheSet = NULL; @@ -389,7 +383,6 @@ ORowSetCache::~ORowSetCache() DBG_DTOR(ORowSetCache,NULL); } -// ------------------------------------------------------------------------- void ORowSetCache::setFetchSize(sal_Int32 _nSize) { if(_nSize == m_nFetchSize) @@ -433,7 +426,7 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize) m_aMatrixIter = m_pMatrix->end(); m_aMatrixEnd = m_pMatrix->end(); - // now adjust their positions because a resize invalid all iterators + // now adjust their positions because a resize invalidates all iterators ::std::vector<sal_Int32>::const_iterator aIter = aPositions.begin(); ::std::map<sal_Int32,sal_Bool>::const_iterator aPosChangeIter = aCacheIterToChange.begin(); for( aCacheIter = m_aCacheIterators.begin(); @@ -465,14 +458,13 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize) m_nEndPos = _nSize; } } -// ------------------------------------------------------------------------- // XResultSetMetaDataSupplier Reference< XResultSetMetaData > ORowSetCache::getMetaData( ) { return m_xMetaData; } -// ------------------------------------------------------------------------- + Any lcl_getBookmark(ORowSetValue& i_aValue,OCacheSet* i_pCacheSet) { switch ( i_aValue.getTypeKind() ) @@ -487,22 +479,21 @@ Any lcl_getBookmark(ORowSetValue& i_aValue,OCacheSet* i_pCacheSet) return i_aValue.getAny(); } } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XRowLocate Any ORowSetCache::getBookmark( ) { - if(m_bAfterLast) throwFunctionSequenceException(m_xSet.get()); - if ( m_aMatrixIter >= m_pMatrix->end() || m_aMatrixIter < m_pMatrix->begin() || !(*m_aMatrixIter).isValid()) + if ( m_aMatrixIter >= m_pMatrix->end() || m_aMatrixIter < m_pMatrix->begin() || !(*m_aMatrixIter).is()) { return Any(); // this is allowed here because the rowset knowns what it is doing } return lcl_getBookmark(((*m_aMatrixIter)->get())[0],m_pCacheSet); } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark ) { if ( m_pCacheSet->moveToBookmark(bookmark) ) @@ -519,7 +510,7 @@ sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark ) if ( !m_bAfterLast ) { m_aMatrixIter = calcPosition(); - OSL_ENSURE(m_aMatrixIter->isValid(),"Iterator after moveToBookmark not valid"); + OSL_ENSURE(m_aMatrixIter->is(),"Iterator after moveToBookmark not valid"); } else m_aMatrixIter = m_pMatrix->end(); @@ -530,9 +521,9 @@ sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark ) else return sal_False; - return m_aMatrixIter != m_pMatrix->end() && (*m_aMatrixIter).isValid(); + return m_aMatrixIter != m_pMatrix->end() && (*m_aMatrixIter).is(); } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) { sal_Bool bRet( moveToBookmark( bookmark ) ); @@ -540,30 +531,29 @@ sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 ro { m_nPosition = m_pCacheSet->getRow() + rows; absolute(m_nPosition); - // for(sal_Int32 i=0;i<rows && m_aMatrixIter != m_pMatrix->end();++i,++m_aMatrixIter) ; - bRet = m_aMatrixIter != m_pMatrix->end() && (*m_aMatrixIter).isValid(); + bRet = m_aMatrixIter != m_pMatrix->end() && (*m_aMatrixIter).is(); } return bRet; } -// ------------------------------------------------------------------------- + sal_Int32 ORowSetCache::compareBookmarks( const Any& _first, const Any& _second ) { return (!_first.hasValue() || !_second.hasValue()) ? CompareBookmark::NOT_COMPARABLE : m_pCacheSet->compareBookmarks(_first,_second); } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::hasOrderedBookmarks( ) { return m_pCacheSet->hasOrderedBookmarks(); } -// ------------------------------------------------------------------------- + sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark ) { return m_pCacheSet->hashBookmark(bookmark); } + // XRowUpdate -// ----------------------------------------------------------------------------- void ORowSetCache::updateNull(sal_Int32 columnIndex,ORowSetValueVector::Vector& io_aRow ,::std::vector<sal_Int32>& o_ChangedColumns ) @@ -582,7 +572,7 @@ void ORowSetCache::updateNull(sal_Int32 columnIndex,ORowSetValueVector::Vector& impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); } } -// ----------------------------------------------------------------------------- + void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x ,ORowSetValueVector::Vector& io_aRow ,::std::vector<sal_Int32>& o_ChangedColumns @@ -602,7 +592,7 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); } } -// ------------------------------------------------------------------------- + void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x , sal_Int32 length,ORowSetValueVector::Vector& io_aRow ,::std::vector<sal_Int32>& o_ChangedColumns @@ -623,10 +613,10 @@ void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); } -// ------------------------------------------------------------------------- + void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x ,ORowSetValueVector::Vector& io_aRow - ,::std::vector<sal_Int32>& o_ChangedColumns + ,::std::vector<sal_Int32>& o_ChangedColumns ) { checkUpdateConditions(columnIndex); @@ -645,7 +635,7 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); } } -// ------------------------------------------------------------------------- + void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ,ORowSetValueVector::Vector& io_aRow ,::std::vector<sal_Int32>& o_ChangedColumns @@ -667,7 +657,7 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); } } -// ------------------------------------------------------------------------- + // XResultSet sal_Bool ORowSetCache::next( ) { @@ -690,27 +680,27 @@ sal_Bool ORowSetCache::next( ) return !m_bAfterLast; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::isBeforeFirst( ) { return m_bBeforeFirst; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::isAfterLast( ) { return m_bAfterLast; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::isFirst( ) { return m_nPosition == 1; // ask resultset for } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::isLast( ) { return m_nPosition == m_nRowCount; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::beforeFirst( ) { if(!m_bBeforeFirst) @@ -724,7 +714,7 @@ sal_Bool ORowSetCache::beforeFirst( ) } return sal_True; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::afterLast( ) { if(!m_bAfterLast) @@ -745,7 +735,7 @@ sal_Bool ORowSetCache::afterLast( ) } return sal_True; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos) { OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!"); @@ -765,12 +755,12 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos } bCheck = m_pCacheSet->absolute(i); // -1 no need to - + for(;i<_nNewEndPos;++i,++aIter) { if(bCheck) { - if(!aIter->isValid()) + if(!aIter->is()) *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*aIter,i); if(!m_bRowCountFinal) @@ -799,7 +789,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos { if(bCheck) { - if(!aIter->isValid()) + if(!aIter->is()) *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*aIter,nPos++); } @@ -813,7 +803,6 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos if ( i < (_nNewEndPos-1) ) bCheck = m_pCacheSet->next(); } - // m_nStartPos = _nNewStartPos; // we have to read one row forward to ensure that we know when we are on last row // but only when we don't know it already /* @@ -832,15 +821,13 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos */ return bCheck; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::moveWindow() { - sal_Bool bRet = sal_True; sal_Int32 nDiff = (sal_Int32)(m_nFetchSize*0.5 -0.5); sal_Int32 nNewStartPos = (m_nPosition - nDiff); - // sal_Int32 nNewEndPos = (m_nPosition+m_nFetchSize*0.5); sal_Int32 nNewEndPos = nNewStartPos + m_nFetchSize; if ( m_nPosition <= m_nStartPos ) @@ -914,8 +901,8 @@ sal_Bool ORowSetCache::moveWindow() } } else - { // normaly this should never happen - OSL_ENSURE(0,"What the hell is happen here!"); + { // normally this should never happen + OSL_FAIL("What the hell is happen here!"); return sal_False; } } @@ -936,7 +923,7 @@ sal_Bool ORowSetCache::moveWindow() bCheck = m_pCacheSet->next(); if ( bCheck ) { - if(!aIter->isValid()) + if(!aIter->is()) *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*aIter,i+1); } @@ -955,7 +942,7 @@ sal_Bool ORowSetCache::moveWindow() { // position in window OSL_ENSURE((m_nPosition - m_nStartPos -1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); m_aMatrixIter = calcPosition(); - if(!m_aMatrixIter->isValid()) + if(!m_aMatrixIter->is()) { sal_Bool bOk( m_pCacheSet->absolute( m_nPosition ) ); if ( bOk ) @@ -1017,7 +1004,6 @@ sal_Bool ORowSetCache::moveWindow() { // the end was reached before end() so we can set the start before nNewStartPos m_nStartPos += (aIter - m_pMatrix->begin()); - // m_nStartPos = (aIter - m_pMatrix->begin()); ::std::rotate(m_pMatrix->begin(),aIter,m_pMatrix->end()); // now correct the iterator in our iterator vector rotateCacheIterator( (sal_Int16)( aIter - m_pMatrix->begin() ) ); @@ -1035,13 +1021,13 @@ sal_Bool ORowSetCache::moveWindow() m_nStartPos = 0; } // here we need only to check if the begining row is valid. If not we have to fetch it. - if(!m_pMatrix->begin()->isValid()) + if(!m_pMatrix->begin()->is()) { aIter = m_pMatrix->begin(); nPos = m_nStartPos; bCheck = m_pCacheSet->absolute_checked(m_nStartPos,sal_False); - for(; !aIter->isValid() && bCheck;++aIter) + for(; !aIter->is() && bCheck;++aIter) { OSL_ENSURE(aIter != m_pMatrix->end(),"Invalid iterator"); bCheck = m_pCacheSet->next(); @@ -1063,7 +1049,7 @@ sal_Bool ORowSetCache::moveWindow() return bRet; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::first( ) { // first move to the first row @@ -1088,7 +1074,7 @@ sal_Bool ORowSetCache::first( ) } return bRet; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::last( ) { sal_Bool bRet = m_pCacheSet->last(); @@ -1104,10 +1090,6 @@ sal_Bool ORowSetCache::last( ) moveWindow(); // we have to repositioning because moveWindow can modify the cache m_pCacheSet->last(); -// if(m_nPosition > m_nFetchSize) -// m_aMatrixIter = m_pMatrix->end() -1; -// else -// m_aMatrixIter = m_pMatrix->begin() + m_nPosition - 1; OSL_ENSURE(((m_nPosition - m_nStartPos) - 1) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!"); m_aMatrixIter = calcPosition(); } @@ -1121,18 +1103,18 @@ sal_Bool ORowSetCache::last( ) #if OSL_DEBUG_LEVEL > 1 if(bRet) { - OSL_ENSURE((*m_aMatrixIter).isValid(),"ORowSetCache::last: Row not valid!"); + OSL_ENSURE((*m_aMatrixIter).is(),"ORowSetCache::last: Row not valid!"); } #endif return bRet; } -// ------------------------------------------------------------------------- + sal_Int32 ORowSetCache::getRow( ) { return (isBeforeFirst() || isAfterLast()) ? 0 : m_nPosition; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::absolute( sal_Int32 row ) { if(!row ) @@ -1185,7 +1167,7 @@ sal_Bool ORowSetCache::absolute( sal_Int32 row ) return !(m_bAfterLast || m_bBeforeFirst); } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::relative( sal_Int32 rows ) { sal_Bool bErg = sal_True; @@ -1213,7 +1195,7 @@ sal_Bool ORowSetCache::relative( sal_Int32 rows ) } return bErg; } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::previous( ) { sal_Bool bRet = sal_False; @@ -1238,13 +1220,13 @@ sal_Bool ORowSetCache::previous( ) else { m_aMatrixIter = calcPosition(); - bRet = (*m_aMatrixIter).isValid(); + bRet = (*m_aMatrixIter).is(); } } } return bRet; } -// ------------------------------------------------------------------------- + void ORowSetCache::refreshRow( ) { if(isAfterLast()) @@ -1257,21 +1239,21 @@ void ORowSetCache::refreshRow( ) cancelRowModification(); } } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::rowUpdated( ) { return m_pCacheSet->rowUpdated(); } -// ------------------------------------------------------------------------- + sal_Bool ORowSetCache::rowInserted( ) { return m_pCacheSet->rowInserted(); } -// ------------------------------------------------------------------------- + // XResultSetUpdate sal_Bool ORowSetCache::insertRow(::std::vector< Any >& o_aBookmarks) { - if ( !m_bNew || !m_aInsertRow->isValid() ) + if ( !m_bNew || !m_aInsertRow->is() ) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_MOVETOINSERTROW_CALLED),NULL,SQLSTATE_GENERAL,1000,Any() ); m_pCacheSet->insertRow(*m_aInsertRow,m_aUpdateTable); @@ -1290,7 +1272,7 @@ sal_Bool ORowSetCache::insertRow(::std::vector< Any >& o_aBookmarks) ORowSetMatrix::iterator aIter = m_pMatrix->begin(); for(;aIter != m_pMatrix->end();++aIter) { - if ( m_aMatrixIter != aIter && aIter->isValid() && m_pCacheSet->columnValuesUpdated((*aIter)->get(),rCurrentRow) ) + if ( m_aMatrixIter != aIter && aIter->is() && m_pCacheSet->columnValuesUpdated((*aIter)->get(),rCurrentRow) ) { o_aBookmarks.push_back(lcl_getBookmark((*aIter)->get()[0],m_pCacheSet)); } @@ -1298,12 +1280,12 @@ sal_Bool ORowSetCache::insertRow(::std::vector< Any >& o_aBookmarks) } else { - OSL_ENSURE(0,"There must be a bookmark after the row was inserted!"); + OSL_FAIL("There must be a bookmark after the row was inserted!"); } } return bRet; } -// ------------------------------------------------------------------------- + void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow) { if ( _bClearInsertRow ) @@ -1311,7 +1293,7 @@ void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow) m_bNew = sal_False; m_bModified = sal_False; } -// ------------------------------------------------------------------------- + void ORowSetCache::cancelRowModification() { // clear the insertrow references -> implies that the current row of the rowset changes as well @@ -1321,10 +1303,10 @@ void ORowSetCache::cancelRowModification() { if ( aCacheIter->second.pRowSet->isInsertRow() && aCacheIter->second.aIterator == m_aInsertRow ) aCacheIter->second.aIterator = m_pMatrix->end(); - } // for(;aCacheIter != aCacheEnd;++aCacheIter) + } resetInsertRow(sal_False); } -// ------------------------------------------------------------------------- + void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow,::std::vector< Any >& o_aBookmarks ) { if(isAfterLast() || isBeforeFirst()) @@ -1338,7 +1320,7 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow,::std::vector m_pCacheSet->updateRow(*_rUpdateRow,*m_aMatrixIter,m_aUpdateTable); // refetch the whole row (*m_aMatrixIter) = NULL; - + if ( moveToBookmark(aBookmark) ) { // update the cached values @@ -1346,7 +1328,7 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow,::std::vector ORowSetMatrix::iterator aIter = m_pMatrix->begin(); for(;aIter != m_pMatrix->end();++aIter) { - if ( m_aMatrixIter != aIter && aIter->isValid() && m_pCacheSet->columnValuesUpdated((*aIter)->get(),rCurrentRow) ) + if ( m_aMatrixIter != aIter && aIter->is() && m_pCacheSet->columnValuesUpdated((*aIter)->get(),rCurrentRow) ) { o_aBookmarks.push_back(lcl_getBookmark((*aIter)->get()[0],m_pCacheSet)); } @@ -1355,13 +1337,12 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow,::std::vector m_bModified = sal_False; } -// ------------------------------------------------------------------------- + bool ORowSetCache::deleteRow( ) { if(isAfterLast() || isBeforeFirst()) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_DELETEROW),NULL,SQLSTATE_GENERAL,1000,Any() ); - // m_pCacheSet->absolute(m_nPosition); m_pCacheSet->deleteRow(*m_aMatrixIter,m_aUpdateTable); if ( !m_pCacheSet->rowDeleted() ) return false; @@ -1372,7 +1353,7 @@ bool ORowSetCache::deleteRow( ) (*aPos) = NULL; ORowSetMatrix::iterator aEnd = m_pMatrix->end(); - for(++aPos;aPos != aEnd && aPos->isValid();++aPos) + for(++aPos;aPos != aEnd && aPos->is();++aPos) { *(aPos-1) = *aPos; (*aPos) = NULL; @@ -1382,13 +1363,13 @@ bool ORowSetCache::deleteRow( ) --m_nPosition; return true; } -// ------------------------------------------------------------------------- + void ORowSetCache::cancelRowUpdates( ) { m_bNew = m_bModified = sal_False; if(!m_nPosition) { - OSL_ENSURE(0,"cancelRowUpdates:Invalid positions pos == 0"); + OSL_FAIL("cancelRowUpdates:Invalid positions pos == 0"); ::dbtools::throwFunctionSequenceException(NULL); } @@ -1396,18 +1377,18 @@ void ORowSetCache::cancelRowUpdates( ) m_pCacheSet->fillValueRow(*m_aMatrixIter,m_nPosition); else { - OSL_ENSURE(0,"cancelRowUpdates couldn't position right with absolute"); + OSL_FAIL("cancelRowUpdates couldn't position right with absolute"); ::dbtools::throwFunctionSequenceException(NULL); } } -// ------------------------------------------------------------------------- + void ORowSetCache::moveToInsertRow( ) { m_bNew = sal_True; m_bUpdated = m_bAfterLast = sal_False; m_aInsertRow = m_pInsertMatrix->begin(); - if(!m_aInsertRow->isValid()) + if(!m_aInsertRow->is()) *m_aInsertRow = new ORowSetValueVector(m_xMetaData->getColumnCount()); // we don't unbound the bookmark column @@ -1421,16 +1402,15 @@ void ORowSetCache::moveToInsertRow( ) aIter->setTypeKind(m_xMetaData->getColumnType(i)); } } -// ------------------------------------------------------------------------- + ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet) { - ORowSetCacheIterator_Helper aHelper; aHelper.aIterator = m_pMatrix->end(); aHelper.pRowSet = _pRowSet; return ORowSetCacheIterator(m_aCacheIterators.insert(m_aCacheIterators.begin(),ORowSetCacheMap::value_type(m_aCacheIterators.size()+1,aHelper)),this,_pRowSet); } -// ----------------------------------------------------------------------------- + void ORowSetCache::deleteIterator(const ORowSetBase* _pRowSet) { ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin(); @@ -1440,12 +1420,12 @@ void ORowSetCache::deleteIterator(const ORowSetBase* _pRowSet) { m_aCacheIterators.erase(aCacheIter); aCacheIter = m_aCacheIterators.begin(); - } // if ( aCacheIter->second.pRowSet == _pRowSet ) + } else ++aCacheIter; } } -// ----------------------------------------------------------------------------- + void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist) { if(_nDist) @@ -1474,11 +1454,11 @@ void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist) } } } -// ------------------------------------------------------------------------- + void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRow) { m_aInsertRow = m_pInsertMatrix->begin(); - if(!m_aInsertRow->isValid()) + if(!m_aInsertRow->is()) *m_aInsertRow = new ORowSetValueVector(m_xMetaData->getColumnCount()); (*(*m_aInsertRow)) = (*(*_rOriginalRow)); @@ -1488,7 +1468,7 @@ void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRo for(;aIter != aEnd;++aIter) aIter->setModified(sal_False); } -// ----------------------------------------------------------------------------- + void ORowSetCache::checkPositionFlags() { if(m_bRowCountFinal) @@ -1498,13 +1478,13 @@ void ORowSetCache::checkPositionFlags() m_nPosition = 0;//m_nRowCount; } } -// ----------------------------------------------------------------------------- + void ORowSetCache::checkUpdateConditions(sal_Int32 columnIndex) { if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->get().size()) throwFunctionSequenceException(m_xSet.get()); } -//------------------------------------------------------------------------------ + sal_Bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode,const Reference< XConnection>& _xConnection,const ::rtl::OUString& _sUpdateTableName) { sal_Bool bOk = sal_False; @@ -1514,10 +1494,10 @@ sal_Bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode { bOk = checkInnerJoin(pNode->getChild(1),_xConnection,_sUpdateTableName); } - else if ((SQL_ISRULE(pNode,search_condition) || SQL_ISRULE(pNode,boolean_term)) && // AND/OR-Verknuepfung: + else if ((SQL_ISRULE(pNode,search_condition) || SQL_ISRULE(pNode,boolean_term)) && // AND/OR link pNode->count() == 3) { - // nur AND Verknüpfung zulassen + // only allow an AND link if ( SQL_ISTOKEN(pNode->getChild(1),AND) ) bOk = checkInnerJoin(pNode->getChild(0),_xConnection,_sUpdateTableName) && checkInnerJoin(pNode->getChild(2),_xConnection,_sUpdateTableName); @@ -1525,7 +1505,7 @@ sal_Bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode else if (SQL_ISRULE(pNode,comparison_predicate)) { // only the comparison of columns is allowed - DBG_ASSERT(pNode->count() == 3,"checkInnerJoin: Fehler im Parse Tree"); + OSL_ENSURE(pNode->count() == 3,"checkInnerJoin: Fehler im Parse Tree"); if (!(SQL_ISRULE(pNode->getChild(0),column_ref) && SQL_ISRULE(pNode->getChild(2),column_ref) && pNode->getChild(1)->getNodeType() == SQL_NODE_EQUAL)) @@ -1543,7 +1523,7 @@ sal_Bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode } return bOk; } -// ----------------------------------------------------------------------------- + sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xAnalyzer, const ::rtl::OUString& _sUpdateTableName ) @@ -1603,11 +1583,11 @@ sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection, } return bOk; } -// ----------------------------------------------------------------------------- + void ORowSetCache::clearInsertRow() { // we don't unbound the bookmark column - if ( m_aInsertRow != m_pInsertMatrix->end() && m_aInsertRow->isValid() ) + if ( m_aInsertRow != m_pInsertMatrix->end() && m_aInsertRow->is() ) { ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin()+1; ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end(); @@ -1616,17 +1596,16 @@ void ORowSetCache::clearInsertRow() aIter->setBound(sal_False); aIter->setModified(sal_False); aIter->setNull(); - } // for(;aIter != (*m_aInsertRow)->end();++aIter) + } } } -// ----------------------------------------------------------------------------- + ORowSetMatrix::iterator ORowSetCache::calcPosition() const { sal_Int32 nValue = (m_nPosition - m_nStartPos) - 1; CHECK_MATRIX_POS(nValue); return ( nValue < 0 || nValue >= static_cast<sal_Int32>(m_pMatrix->size()) ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue); } -// ----------------------------------------------------------------------------- TORowSetOldRowHelperRef ORowSetCache::registerOldRow() { @@ -1634,13 +1613,13 @@ TORowSetOldRowHelperRef ORowSetCache::registerOldRow() m_aOldRows.push_back(pRef); return pRef; } -// ----------------------------------------------------------------------------- + void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow) { TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end(); for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter) { - if ( aOldRowIter->getBodyPtr() == _rRow.getBodyPtr() ) + if ( aOldRowIter->get() == _rRow.get() ) { m_aOldRows.erase(aOldRowIter); break; @@ -1648,35 +1627,35 @@ void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow) } } -// ----------------------------------------------------------------------------- + sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPos) { TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end(); for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter) { - if ( aOldRowIter->isValid() && aOldRowIter->getBody().getRow().isValid() ) - aOldRowIter->getBody().setRow(new ORowSetValueVector(aOldRowIter->getBody().getRow().getBody()) ); + if ( aOldRowIter->is() && (*aOldRowIter)->getRow().is() ) + (*aOldRowIter)->setRow(new ORowSetValueVector( *((*aOldRowIter)->getRow()) ) ); } sal_Int32 nNewSt = _nNewStartPos; sal_Bool bRet = fillMatrix(nNewSt,_nNewEndPos); m_nStartPos = nNewSt - 1; - rotateCacheIterator(static_cast<sal_Int16>(m_nFetchSize+1)); // forces that every iterator will be set to null + rotateCacheIterator(static_cast<sal_Int16>(m_nFetchSize+1)); // forces every iterator to null return bRet; } -// ----------------------------------------------------------------------------- + sal_Bool ORowSetCache::fill(ORowSetMatrix::iterator& _aIter,const ORowSetMatrix::iterator& _aEnd,sal_Int32& _nPos,sal_Bool _bCheck) { sal_Int32 nColumnCount = m_xMetaData->getColumnCount(); for(; _bCheck && _aIter != _aEnd;) { - if ( !_aIter->isValid() ) + if ( !_aIter->is() ) *_aIter = new ORowSetValueVector(nColumnCount); else { TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end(); for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter) { - if ( aOldRowIter->getBody().getRow().isEqualBody(*_aIter) ) + if ( (*aOldRowIter)->getRow() == *_aIter ) *_aIter = new ORowSetValueVector(nColumnCount); } } @@ -1685,12 +1664,12 @@ sal_Bool ORowSetCache::fill(ORowSetMatrix::iterator& _aIter,const ORowSetMatrix: } return _bCheck; } -// ----------------------------------------------------------------------------- + bool ORowSetCache::isResultSetChanged() const { return m_pCacheSet->isResultSetChanged(); } -// ----------------------------------------------------------------------------- + void ORowSetCache::reset(const Reference< XResultSet>& _xDriverSet) { m_xMetaData.set(Reference< XResultSetMetaDataSupplier >(_xDriverSet,UNO_QUERY)->getMetaData()); @@ -1700,7 +1679,7 @@ void ORowSetCache::reset(const Reference< XResultSet>& _xDriverSet) m_nRowCount = 0; reFillMatrix(m_nStartPos+1,m_nEndPos+1); } -// ----------------------------------------------------------------------------- + void ORowSetCache::impl_updateRowFromCache_throw(ORowSetValueVector::Vector& io_aRow ,::std::vector<sal_Int32>& o_ChangedColumns) { @@ -1709,16 +1688,16 @@ void ORowSetCache::impl_updateRowFromCache_throw(ORowSetValueVector::Vector& io_ ORowSetMatrix::iterator aIter = m_pMatrix->begin(); for(;aIter != m_pMatrix->end();++aIter) { - if ( aIter->isValid() && m_pCacheSet->updateColumnValues((*aIter)->get(),io_aRow,o_ChangedColumns)) + if ( aIter->is() && m_pCacheSet->updateColumnValues((*aIter)->get(),io_aRow,o_ChangedColumns)) { break; } } - + if ( aIter == m_pMatrix->end() ) { m_pCacheSet->fillMissingValues(io_aRow); } } } -// ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index 065fb2fad..0ce22af54 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,78 +28,30 @@ #ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX #define DBACCESS_CORE_API_ROWSETCACHE_HXX -#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #include <connectivity/CommonTools.hxx> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYANALYZER_HPP_ #include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYANALYZER_HPP_ #include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ #include <com/sun/star/sdbc/XWarningsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XRESULTSETACCESS_HPP_ #include <com/sun/star/sdb/XResultSetAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ #include <com/sun/star/sdbc/XColumnLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ #include <com/sun/star/sdbcx/XRowLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ #include <com/sun/star/sdbc/XRowUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ #include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XROWSETAPPROVEBROADCASTER_HPP_ #include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ #include <com/sun/star/sdbc/ResultSetType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDELETEROWS_HPP_ #include <com/sun/star/sdbcx/XDeleteRows.hpp> -#endif -#ifndef _CPPUHELPER_COMPBASE11_HXX_ #include <cppuhelper/compbase11.hxx> -#endif -#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_ #include <comphelper/propertycontainer.hxx> -#endif -#ifndef COMPHELPER_COMPONENTCONTEXT_HXX #include <comphelper/componentcontext.hxx> -#endif -#ifndef _CPPUHELPER_IMPLBASE5_HXX_ #include <cppuhelper/implbase5.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include <comphelper/proparrhlp.hxx> -#endif -#ifndef DBACCESS_CORE_API_ROWSETROW_HXX #include "RowSetRow.hxx" -#endif -#ifndef DBACCESS_ROWSETCACHEITERATOR_HXX #include "RowSetCacheIterator.hxx" -#endif namespace connectivity { @@ -137,7 +90,6 @@ namespace dbaccess ORowSetMatrix* m_pInsertMatrix; // represent the rows which should be inserted normally this is only one ORowSetMatrix::iterator m_aInsertRow; // represent a insert row - // ORowSetRow m_aInsertRow; // present the row that should be inserted sal_Int32 m_nLastColumnIndex; // the last column ask for, used for wasNull() connectivity::OSQLTable m_aUpdateTable; // used for updates/deletes and inserts @@ -272,3 +224,4 @@ namespace dbaccess } #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSetCacheIterator.cxx b/dbaccess/source/core/api/RowSetCacheIterator.cxx index 91863147c..986a9bb5d 100644 --- a/dbaccess/source/core/api/RowSetCacheIterator.cxx +++ b/dbaccess/source/core/api/RowSetCacheIterator.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,15 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_ROWSETCACHEITERATOR_HXX #include "RowSetCacheIterator.hxx" -#endif -#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX #include "RowSetCache.hxx" -#endif -#ifndef DBACCESS_CORE_API_ROWSETBASE_HXX #include "RowSetBase.hxx" -#endif #include <rtl/logfile.hxx> using namespace dbaccess; @@ -46,12 +41,12 @@ ORowSetCacheIterator::ORowSetCacheIterator(const ORowSetCacheIterator& _rRH) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::ORowSetCacheIterator" ); } -// ----------------------------------------------------------------------------- + ORowSetCacheIterator::operator ORowSetMatrix::iterator() { return m_aIter->second.aIterator; } -// ----------------------------------------------------------------------------- + ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetCacheIterator& _rRH) { if(this == &_rRH) @@ -63,18 +58,18 @@ ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetCacheIterato return *this; } -// ----------------------------------------------------------------------------- + ORowSetCacheIterator& ORowSetCacheIterator::operator =(const ORowSetMatrix::iterator& _rIter) { m_aIter->second.aIterator = _rIter; return *this; } -// ----------------------------------------------------------------------------- + ORowSetRow& ORowSetCacheIterator::operator *() { return *m_aIter->second.aIterator; } -// ----------------------------------------------------------------------------- + const ORowSetRow& ORowSetCacheIterator::operator *() const { if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() ) @@ -85,12 +80,12 @@ const ORowSetRow& ORowSetCacheIterator::operator *() const } return *m_aIter->second.aIterator; } -// ----------------------------------------------------------------------------- + ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->() { return m_aIter->second.aIterator; } -// ----------------------------------------------------------------------------- + const ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->() const { if ( !m_pRowSet->isInsertRow() && m_aIter->second.aIterator == m_pCache->m_pMatrix->end() ) @@ -101,33 +96,33 @@ const ORowSetMatrix::iterator& ORowSetCacheIterator::operator ->() const } return m_aIter->second.aIterator; } -// ----------------------------------------------------------------------------- + bool ORowSetCacheIterator::operator <=(const ORowSetMatrix::iterator& _rRH) const { return m_aIter->second.aIterator <= _rRH; } -// ----------------------------------------------------------------------------- + bool ORowSetCacheIterator::operator <(const ORowSetMatrix::iterator& _rRH) const { return m_aIter->second.aIterator < _rRH; } -// ----------------------------------------------------------------------------- + bool ORowSetCacheIterator::operator !=(const ORowSetMatrix::iterator& _rRH) const { return m_aIter->second.aIterator != _rRH; } -// ----------------------------------------------------------------------------- + bool ORowSetCacheIterator::operator ==(const ORowSetMatrix::iterator& _rRH) const { return m_aIter->second.aIterator == _rRH; } -// ----------------------------------------------------------------------------- + void ORowSetCacheIterator::setBookmark(const ::com::sun::star::uno::Any& _rBookmark) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::setBookmark" ); m_aIter->second.aBookmark = _rBookmark; } -// ----------------------------------------------------------------------------- + sal_Bool ORowSetCacheIterator::isNull() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::isNull" ); @@ -136,7 +131,7 @@ sal_Bool ORowSetCacheIterator::isNull() const { ORowSetCacheIterator_Helper aHelper = m_aIter->second; bRet = ( m_pRowSet->isInsertRow() - ? + ? m_aIter->second.aIterator == m_pCache->m_pInsertMatrix->end() : m_aIter->second.aIterator == m_pCache->m_pMatrix->end() @@ -144,9 +139,11 @@ sal_Bool ORowSetCacheIterator::isNull() const } return bRet; } -// ----------------------------------------------------------------------------- + ::osl::Mutex* ORowSetCacheIterator::getMutex() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCacheIterator::getMutex" ); return m_pRowSet ? m_pRowSet->getMutex() : NULL; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSetCacheIterator.hxx b/dbaccess/source/core/api/RowSetCacheIterator.hxx index 641e0309d..1387635d4 100644 --- a/dbaccess/source/core/api/RowSetCacheIterator.hxx +++ b/dbaccess/source/core/api/RowSetCacheIterator.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,12 +28,8 @@ #ifndef DBACCESS_ROWSETCACHEITERATOR_HXX #define DBACCESS_ROWSETCACHEITERATOR_HXX -#ifndef DBACCESS_CORE_API_ROWSETROW_HXX #include "RowSetRow.hxx" -#endif -#ifndef _COMPHELPER_STLTYPES_HXX_ #include <comphelper/stl_types.hxx> -#endif namespace dbaccess { @@ -43,7 +40,7 @@ namespace dbaccess ::com::sun::star::uno::Any aBookmark; ORowSetBase* pRowSet; } ORowSetCacheIterator_Helper; - + DECLARE_STL_STDKEY_MAP(sal_Int32,ORowSetCacheIterator_Helper,ORowSetCacheMap); class ORowSetCache; @@ -54,7 +51,7 @@ namespace dbaccess ORowSetCache* m_pCache; ORowSetBase* m_pRowSet; protected: - ORowSetCacheIterator(const ORowSetCacheMap::iterator& _rIter,ORowSetCache* _pCache,ORowSetBase* _pRowSet) + ORowSetCacheIterator(const ORowSetCacheMap::iterator& _rIter,ORowSetCache* _pCache,ORowSetBase* _pRowSet) : m_aIter(_rIter) ,m_pCache(_pCache) ,m_pRowSet(_pRowSet) @@ -71,7 +68,7 @@ namespace dbaccess ORowSetRow& operator *(); const ORowSetRow& operator *() const; - + ORowSetMatrix::iterator& operator ->(); const ORowSetMatrix::iterator& operator ->() const; @@ -89,4 +86,4 @@ namespace dbaccess } #endif // DBACCESS_ROWSETCACHEITERATOR_HXX - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/RowSetRow.hxx b/dbaccess/source/core/api/RowSetRow.hxx index e7ccd399d..88e53ea5f 100644 --- a/dbaccess/source/core/api/RowSetRow.hxx +++ b/dbaccess/source/core/api/RowSetRow.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,23 +28,15 @@ #ifndef DBACCESS_CORE_API_ROWSETROW_HXX #define DBACCESS_CORE_API_ROWSETROW_HXX -#ifndef _VOS_REF_HXX_ -#include <vos/ref.hxx> -#endif -#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include <rtl/ref.hxx> #include <connectivity/CommonTools.hxx> -#endif -#ifndef _CONNECTIVITY_FILE_VALUE_HXX_ #include "connectivity/FValue.hxx" -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif namespace dbaccess { typedef connectivity::ORowVector< connectivity::ORowSetValue > ORowSetValueVector; - typedef ::vos::ORef< ORowSetValueVector > ORowSetRow; + typedef ::rtl::Reference< ORowSetValueVector > ORowSetRow; typedef ::std::vector< ORowSetRow > ORowSetMatrix; class ORowSetOldRowHelper @@ -55,14 +48,10 @@ namespace dbaccess ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh); public: ORowSetOldRowHelper() : m_refCount(0){} - ORowSetOldRowHelper(const ORowSetRow& _rRow) + ORowSetOldRowHelper(const ORowSetRow& _rRow) : m_refCount(0) , m_aRow(_rRow) {} -// ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh) -// : m_refCount(0) -// , m_aRow(_rRh.m_aRow) -// {} void acquire() { @@ -78,7 +67,7 @@ namespace dbaccess inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; } }; - typedef ::vos::ORef< ORowSetOldRowHelper > TORowSetOldRowHelperRef; + typedef ::rtl::Reference< ORowSetOldRowHelper > TORowSetOldRowHelperRef; class ORowSetValueCompare { @@ -106,3 +95,4 @@ namespace dbaccess } #endif // DBACCESS_CORE_API_ROWSETROW_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 7587e29fe..518a41912 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -63,6 +64,7 @@ #include <unotools/syslocale.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <osl/diagnose.h> #include <unotools/configmgr.hxx> #include <unotools/sharedunocomponent.hxx> @@ -104,10 +106,8 @@ namespace BooleanComparisonMode = ::com::sun::star::sdb::BooleanComparisonMode; #define R_BRACKET ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")) #define COMMA ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")) -// ------------------------------------------------------------------------- namespace { - // ..................................................................... /** parses the given statement, using the given parser, returns a parse node representing the statement @@ -241,7 +241,7 @@ namespace } DBG_NAME(OSingleSelectQueryComposer) -// ------------------------------------------------------------------------- + OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAccess>& _rxTables, const Reference< XConnection>& _xConnection, const ::comphelper::ComponentContext& _rContext ) @@ -292,7 +292,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc { } } -// ------------------------------------------------------------------------- + OSingleSelectQueryComposer::~OSingleSelectQueryComposer() { DBG_DTOR(OSingleSelectQueryComposer,NULL); @@ -306,7 +306,7 @@ OSingleSelectQueryComposer::~OSingleSelectQueryComposer() for(;aTabIter != aTabEnd;++aTabIter) delete *aTabIter; } -// ------------------------------------------------------------------------- + // OComponentHelper void SAL_CALL OSingleSelectQueryComposer::disposing(void) { @@ -328,7 +328,6 @@ IMPLEMENT_SERVICE_INFO1(OSingleSelectQueryComposer,"org.openoffice.comp.dba.OSin IMPLEMENT_TYPEPROVIDER3(OSingleSelectQueryComposer,OSubComponent,OSingleSelectQueryComposer_BASE,OPropertyContainer) IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OSingleSelectQueryComposer) -// ------------------------------------------------------------------------- // com::sun::star::lang::XUnoTunnel sal_Int64 SAL_CALL OSingleSelectQueryComposer::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { @@ -339,7 +338,6 @@ sal_Int64 SAL_CALL OSingleSelectQueryComposer::getSomething( const Sequence< sal return sal_Int64(0); } -// ------------------------------------------------------------------------- // XSingleSelectQueryAnalyzer ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getQuery( ) throw(RuntimeException) { @@ -351,7 +349,6 @@ sal_Int64 SAL_CALL OSingleSelectQueryComposer::getSomething( const Sequence< sal return getStatementPart(F_tmp,m_aSqlIterator); } -// ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setQuery( const ::rtl::OUString& command ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "OSingleSelectQueryComposer::setQuery" ); @@ -372,9 +369,9 @@ void SAL_CALL OSingleSelectQueryComposer::setQuery( const ::rtl::OUString& comma for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) m_aElementaryParts[ eLoopParts ] = ::rtl::OUString(); } -// ------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::setCommand( const ::rtl::OUString& Command,sal_Int32 _nCommandType ) throw(SQLException, RuntimeException) -{ +{ ::rtl::OUStringBuffer sSQL; switch(_nCommandType) { @@ -400,7 +397,7 @@ void SAL_CALL OSingleSelectQueryComposer::setCommand( const ::rtl::OUString& Com { DBG_UNHANDLED_EXCEPTION(); } - + sSQL.append(dbtools::composeTableNameForSelect(m_xConnection,xTable)); } else @@ -413,7 +410,7 @@ void SAL_CALL OSingleSelectQueryComposer::setCommand( const ::rtl::OUString& Com case CommandType::QUERY: if ( m_xConnectionQueries->hasByName(Command) ) { - + Reference<XPropertySet> xQuery(m_xConnectionQueries->getByName(Command),UNO_QUERY); ::rtl::OUString sCommand; xQuery->getPropertyValue(PROPERTY_COMMAND) >>= sCommand; @@ -425,7 +422,7 @@ void SAL_CALL OSingleSelectQueryComposer::setCommand( const ::rtl::OUString& Com sMessage.SearchAndReplaceAscii( "$table$", Command ); throwGenericSQLException(sMessage,*this); } - + break; default: break; @@ -441,16 +438,8 @@ void SAL_CALL OSingleSelectQueryComposer::setCommand( const ::rtl::OUString& Com ::rtl::OUString sCommand = sSQL.makeStringAndClear(); setElementaryQuery(sCommand); m_sOrignal = sCommand; -/* - // reset the additive iterator to the same statement - parseAndCheck_throwError( m_aSqlParser, m_sOrignal, m_aAdditiveIterator, *this ); - - // we have no "elementary" parts anymore (means filter/groupby/having/order clauses) - for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) - m_aElementaryParts[ eLoopParts ] = ::rtl::OUString(); -*/ } -// ----------------------------------------------------------------------------- + void OSingleSelectQueryComposer::setQuery_Impl( const ::rtl::OUString& command ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "OSingleSelectQueryComposer::setQuery_Impl" ); @@ -460,41 +449,38 @@ void OSingleSelectQueryComposer::setQuery_Impl( const ::rtl::OUString& command ) // strip it from all clauses, to have the pure SELECT statement m_aPureSelectSQL = getPureSelectStatement( m_aSqlIterator.getParseTree(), m_xConnection ); - // update columns and tables - // why? Shouldn't this be done on request only? - // otherwise nothing is working anymore :-) -// getColumns(); + // update tables getTables(); } -// ----------------------------------------------------------------------------- + Sequence< Sequence< PropertyValue > > SAL_CALL OSingleSelectQueryComposer::getStructuredHavingClause( ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStructuredHavingClause" ); TGetParseNode F_tmp(&OSQLParseTreeIterator::getSimpleHavingTree); return getStructuredCondition(F_tmp); } -// ------------------------------------------------------------------------- + Sequence< Sequence< PropertyValue > > SAL_CALL OSingleSelectQueryComposer::getStructuredFilter( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStructuredFilter" ); TGetParseNode F_tmp(&OSQLParseTreeIterator::getSimpleWhereTree); return getStructuredCondition(F_tmp); } -// ----------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::appendHavingClauseByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria,sal_Int32 filterOperator ) throw (SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendHavingClauseByColumn" ); ::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString> F_tmp(&OSingleSelectQueryComposer::implSetHavingClause); setConditionByColumn(column,andCriteria,F_tmp,filterOperator); } -// ----------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::appendFilterByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria,sal_Int32 filterOperator ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendFilterByColumn" ); ::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString> F_tmp(&OSingleSelectQueryComposer::implSetFilter); setConditionByColumn(column,andCriteria,F_tmp,filterOperator); } -// ----------------------------------------------------------------------------- + ::rtl::OUString OSingleSelectQueryComposer::impl_getColumnName_throw(const Reference< XPropertySet >& column) { ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); @@ -564,7 +550,7 @@ void SAL_CALL OSingleSelectQueryComposer::appendFilterByColumn( const Reference< aNewName = getTableAlias(column) + ::dbtools::quoteName(aQuote,aName); return aNewName; } -// ------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< XPropertySet >& column, sal_Bool ascending ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendOrderByColumn" ); @@ -580,7 +566,6 @@ void SAL_CALL OSingleSelectQueryComposer::appendOrderByColumn( const Reference< setOrder(sOrder); } -// ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::appendGroupByColumn( const Reference< XPropertySet >& column) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendGroupByColumn" ); @@ -591,11 +576,11 @@ void SAL_CALL OSingleSelectQueryComposer::appendGroupByColumn( const Reference< aComposer.append( sColumnName ); setGroup( aComposer.getComposedAndClear() ); } -// ------------------------------------------------------------------------- + ::rtl::OUString OSingleSelectQueryComposer::composeStatementFromParts( const ::std::vector< ::rtl::OUString >& _rParts ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::composeStatementFromParts" ); - DBG_ASSERT( _rParts.size() == (size_t)SQLPartCount, "OSingleSelectQueryComposer::composeStatementFromParts: invalid parts array!" ); + OSL_ENSURE( _rParts.size() == (size_t)SQLPartCount, "OSingleSelectQueryComposer::composeStatementFromParts: invalid parts array!" ); ::rtl::OUStringBuffer aSql( m_aPureSelectSQL ); for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) ) @@ -608,14 +593,12 @@ void SAL_CALL OSingleSelectQueryComposer::appendGroupByColumn( const Reference< return aSql.makeStringAndClear(); } -// ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getElementaryQuery() throw (::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getElementaryQuery" ); return composeStatementFromParts( m_aElementaryParts ); } -// ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setElementaryQuery( const ::rtl::OUString& _rElementary ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "OSingleSelectQueryComposer::setElementaryQuery" ); @@ -644,13 +627,12 @@ void SAL_CALL OSingleSelectQueryComposer::setElementaryQuery( const ::rtl::OUStr catch( const Exception& e ) { (void)e; - DBG_ERROR( "OSingleSelectQueryComposer::setElementaryQuery: there should be no error anymore for the additive statement!" ); + OSL_FAIL( "OSingleSelectQueryComposer::setElementaryQuery: there should be no error anymore for the additive statement!" ); // every part of the additive statement should have passed other tests already, and should not // be able to cause any errors ... me thinks } } -// ------------------------------------------------------------------------- namespace { ::rtl::OUString getComposedClause( const ::rtl::OUString _rElementaryClause, const ::rtl::OUString _rAdditionalClause, @@ -666,7 +648,6 @@ namespace } } -// ------------------------------------------------------------------------- void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const ::rtl::OUString& _rClause ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setSingleAdditiveClause" ); @@ -724,39 +705,36 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const catch( const Exception& e ) { (void)e; - DBG_ERROR( "OSingleSelectQueryComposer::setSingleAdditiveClause: there should be no error anymore for the additive statement!" ); + OSL_FAIL( "OSingleSelectQueryComposer::setSingleAdditiveClause: there should be no error anymore for the additive statement!" ); // every part of the additive statement should have passed other tests already, and should not // be able to cause any errors ... me thinks } } -// ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setFilter( const ::rtl::OUString& filter ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setFilter" ); setSingleAdditiveClause( Where, filter ); } -// ------------------------------------------------------------------------- void SAL_CALL OSingleSelectQueryComposer::setOrder( const ::rtl::OUString& order ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setOrder" ); setSingleAdditiveClause( Order, order ); } -// ----------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::setGroup( const ::rtl::OUString& group ) throw (SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setGroup" ); setSingleAdditiveClause( Group, group ); } -// ------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::setHavingClause( const ::rtl::OUString& filter ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setHavingClause" ); setSingleAdditiveClause( Having, filter ); } -// ------------------------------------------------------------------------- // XTablesSupplier Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( ) throw(RuntimeException) { @@ -777,7 +755,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( ) thro return m_pTables; } -// ------------------------------------------------------------------------- + // XColumnsSupplier Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) throw(RuntimeException) { @@ -788,7 +766,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr return m_aCurrentColumns[SelectColumns]; ::std::vector< ::rtl::OUString> aNames; - ::vos::ORef< OSQLColumns> aSelectColumns; + ::rtl::Reference< OSQLColumns> aSelectColumns; sal_Bool bCase = sal_True; Reference< XNameAccess> xQueryColumns; if ( m_nCommandType == CommandType::QUERY ) @@ -813,7 +791,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr aSQL.append( STR_WHERE ); // preserve the original WHERE clause - // #i102234# / 2009-06-02 / frank.schoenheit@sun.com + // #i102234# ::rtl::OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, sal_False ); if ( sOriginalWhereClause.getLength() ) { @@ -834,7 +812,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr // normalize the statement so that it doesn't contain any application-level features anymore ::rtl::OUString sError; const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSQL, false ) ); - DBG_ASSERT( pStatementTree.get(), "OSingleSelectQueryComposer::getColumns: could not parse the column retrieval statement!" ); + OSL_ENSURE( pStatementTree.get(), "OSingleSelectQueryComposer::getColumns: could not parse the column retrieval statement!" ); if ( pStatementTree.get() ) if ( !pStatementTree->parseNodeToExecutableStatement( sSQL, m_xConnection, m_aSqlParser, NULL ) ) break; @@ -861,10 +839,10 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW ); } } - catch( const Exception& ) - { - //@see issue http://qa.openoffice.org/issues/show_bug.cgi?id=110111 - // access returns a different order of column names when executing select * from + catch( const Exception& ) + { + //@see issue http://qa.openoffice.org/issues/show_bug.cgi?id=110111 + // access returns a different order of column names when executing select * from // and asking the columns from the metadata. Reference< XParameters > xParameters( xPreparedStatement, UNO_QUERY_THROW ); Reference< XIndexAccess > xPara = getParameters(); @@ -959,11 +937,10 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr if ( !sColumnName.getLength() ) xProp->getPropertyValue(PROPERTY_NAME) >>= sColumnName; - aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName)); sal_Int32 j = 0; while ( aFindName != aNames.end() ) - { + { sColumnName += ::rtl::OUString::valueOf(++j); aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName)); } @@ -971,7 +948,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr pColumn->setName(sColumnName); pColumn->setRealName(sRealName); pColumn->setTableName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_TABLENAME))); - + (aSelectColumns->get())[i-1] = pColumn; } else @@ -994,7 +971,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr return m_aCurrentColumns[SelectColumns]; } -// ------------------------------------------------------------------------- + sal_Bool OSingleSelectQueryComposer::setORCriteria(OSQLParseNode* pCondition, OSQLParseTreeIterator& _rIterator, ::std::vector< ::std::vector < PropertyValue > >& rFilters, const Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter) const { @@ -1015,7 +992,6 @@ sal_Bool OSingleSelectQueryComposer::setORCriteria(OSQLParseNode* pCondition, OS { // Ist das erste Element wieder eine OR-Verknuepfung? // Dann rekursiv absteigen ... - //if (!i && SQL_ISRULE(pCondition->getChild(i),search_condition)) if (SQL_ISRULE(pCondition->getChild(i),search_condition)) bResult = setORCriteria(pCondition->getChild(i), _rIterator, rFilters, xFormatter); else @@ -1033,7 +1009,6 @@ sal_Bool OSingleSelectQueryComposer::setORCriteria(OSQLParseNode* pCondition, OS } } -//-------------------------------------------------------------------------------------------------- sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, OSQLParseTreeIterator& _rIterator, ::std::vector < PropertyValue >& rFilter, const Reference< XNumberFormatter > & xFormatter) const { @@ -1042,7 +1017,7 @@ sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, if (SQL_ISRULE(pCondition,boolean_primary)) { // this should not occur - DBG_ERROR("boolean_primary in And-Criteria"); + OSL_FAIL("boolean_primary in And-Criteria"); return sal_False; } // Das erste Element ist (wieder) eine AND-Verknuepfung @@ -1068,9 +1043,7 @@ sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, ::rtl::OUString aColumnName; - // pCondition->parseNodeToStr(aValue,m_xMetaData, xFormatter, m_aLocale,static_cast<sal_Char>(m_sDecimalSep.toChar())); pCondition->parseNodeToStr( aValue, m_xConnection, NULL ); - // pCondition->getChild(0)->parseNodeToStr(aColumnName,m_xMetaData, xFormatter, m_aLocale,static_cast<sal_Char>(m_sDecimalSep.toChar())); pCondition->getChild(0)->parseNodeToStr( aColumnName, m_xConnection, NULL ); // don't display the column name @@ -1096,15 +1069,15 @@ sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, } else if (SQL_ISRULE(pCondition,in_predicate)) { - OSL_ENSURE( false, "OSingleSelectQueryComposer::setANDCriteria: in_predicate not implemented!" ); + OSL_FAIL( "OSingleSelectQueryComposer::setANDCriteria: in_predicate not implemented!" ); } else if (SQL_ISRULE(pCondition,all_or_any_predicate)) { - OSL_ENSURE( false, "OSingleSelectQueryComposer::setANDCriteria: all_or_any_predicate not implemented!" ); + OSL_FAIL( "OSingleSelectQueryComposer::setANDCriteria: all_or_any_predicate not implemented!" ); } else if (SQL_ISRULE(pCondition,between_predicate)) { - OSL_ENSURE( false, "OSingleSelectQueryComposer::setANDCriteria: between_predicate not implemented!" ); + OSL_FAIL( "OSingleSelectQueryComposer::setANDCriteria: between_predicate not implemented!" ); } rFilter.push_back(aItem); @@ -1124,7 +1097,7 @@ sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, return sal_True; } -// ----------------------------------------------------------------------------- + sal_Int32 OSingleSelectQueryComposer::getPredicateType(OSQLParseNode * _pPredicate) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getPredicateType" ); @@ -1150,16 +1123,16 @@ sal_Int32 OSingleSelectQueryComposer::getPredicateType(OSQLParseNode * _pPredica nPredicate = SQLFilterOperator::GREATER_EQUAL; break; default: - OSL_ENSURE(0,"Wrong NodeType!"); + OSL_FAIL("Wrong NodeType!"); } return nPredicate; } -//------------------------------------------------------------------------------ + sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCondition, OSQLParseTreeIterator& _rIterator, ::std::vector < PropertyValue >& rFilter, const Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setComparsionPredicate" ); - DBG_ASSERT(SQL_ISRULE(pCondition, comparison_predicate),"setComparsionPredicate: pCondition ist kein ComparsionPredicate"); + OSL_ENSURE(SQL_ISRULE(pCondition, comparison_predicate),"setComparsionPredicate: pCondition ist kein ComparsionPredicate"); if (SQL_ISRULE(pCondition->getChild(0), column_ref) || SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref)) { @@ -1277,8 +1250,8 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon } return sal_True; } + // functions for analysing SQL -//-------------------------------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getColumnName( ::connectivity::OSQLParseNode* pColumnRef, OSQLParseTreeIterator& _rIterator ) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getColumnName" ); @@ -1286,7 +1259,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon _rIterator.getColumnRange(pColumnRef,aColumnName,aTableRange); return aColumnName; } -//------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getFilter( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getFilter" ); @@ -1294,7 +1267,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Where,m_aAdditiveIterator,sal_False); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getOrder( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getOrder" ); @@ -1302,7 +1275,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Order,m_aAdditiveIterator,sal_False); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getGroup( ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getGroup" ); @@ -1310,7 +1283,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Group,m_aAdditiveIterator,sal_False); } -// ----------------------------------------------------------------------------- + ::rtl::OUString OSingleSelectQueryComposer::getHavingClause() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getHavingClause" ); @@ -1318,7 +1291,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon ::osl::MutexGuard aGuard( m_aMutex ); return getSQLPart(Having,m_aAdditiveIterator,sal_False); } -// ----------------------------------------------------------------------------- + ::rtl::OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet >& column) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getTableAlias" ); @@ -1336,7 +1309,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); if(!aTable.getLength()) - { // we don't found a table name, now we must search every table for this column + { // we haven't found a table name, now we must search every table for this column for(;pBegin != pEnd;++pBegin) { Reference<XColumnsSupplier> xColumnsSupp; @@ -1344,10 +1317,6 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon if(xColumnsSupp.is() && xColumnsSupp->getColumns()->hasByName(aColumnName)) { -// Reference<XPropertySet> xTableProp(xColumnsSupp,UNO_QUERY); -// xTableProp->getPropertyValue(PROPERTY_CATALOGNAME) >>= aCatalog; -// xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= aSchema; -// xTableProp->getPropertyValue(PROPERTY_NAME) >>= aTable; aTable = *pBegin; break; } @@ -1393,16 +1362,16 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon } return sReturn; } -// ----------------------------------------------------------------------------- + Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getParameters" ); // now set the Parameters if ( !m_aCurrentColumns[ParameterColumns] ) { - ::vos::ORef< OSQLColumns> aCols = m_aSqlIterator.getParameters(); + ::rtl::Reference< OSQLColumns> aCols = m_aSqlIterator.getParameters(); ::std::vector< ::rtl::OUString> aNames; - OSQLColumns::Vector::const_iterator aEnd = aCols->get().end(); + OSQLColumns::Vector::const_iterator aEnd = aCols->get().end(); for(OSQLColumns::Vector::const_iterator aIter = aCols->get().begin(); aIter != aEnd;++aIter) aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME))); m_aCurrentColumns[ParameterColumns] = new OPrivateColumns(aCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True); @@ -1410,7 +1379,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( ) return m_aCurrentColumns[ParameterColumns]; } -// ----------------------------------------------------------------------------- + void OSingleSelectQueryComposer::clearColumns( const EColumnType _eType ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearColumns" ); @@ -1422,7 +1391,7 @@ void OSingleSelectQueryComposer::clearColumns( const EColumnType _eType ) m_aCurrentColumns[ _eType ] = NULL; } } -// ----------------------------------------------------------------------------- + void OSingleSelectQueryComposer::clearCurrentCollections() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearCurrentCollections" ); @@ -1445,9 +1414,9 @@ void OSingleSelectQueryComposer::clearCurrentCollections() m_pTables = NULL; } } -// ----------------------------------------------------------------------------- + Reference< XIndexAccess > OSingleSelectQueryComposer::setCurrentColumns( EColumnType _eType, - const ::vos::ORef< OSQLColumns >& _rCols ) + const ::rtl::Reference< OSQLColumns >& _rCols ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setCurrentColumns" ); ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed); @@ -1457,7 +1426,7 @@ Reference< XIndexAccess > OSingleSelectQueryComposer::setCurrentColumns( EColumn if ( !m_aCurrentColumns[_eType] ) { ::std::vector< ::rtl::OUString> aNames; - OSQLColumns::Vector::const_iterator aEnd = _rCols->get().end(); + OSQLColumns::Vector::const_iterator aEnd = _rCols->get().end(); for(OSQLColumns::Vector::const_iterator aIter = _rCols->get().begin(); aIter != aEnd;++aIter) aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME))); m_aCurrentColumns[_eType] = new OPrivateColumns(_rCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True); @@ -1465,19 +1434,19 @@ Reference< XIndexAccess > OSingleSelectQueryComposer::setCurrentColumns( EColumn return m_aCurrentColumns[_eType]; } -// ----------------------------------------------------------------------------- + Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getGroupColumns( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getGroupColumns" ); return setCurrentColumns( GroupByColumns, m_aAdditiveIterator.getGroupColumns() ); } -// ------------------------------------------------------------------------- + Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getOrderColumns" ); return setCurrentColumns( OrderColumns, m_aAdditiveIterator.getOrderColumns() ); } -// ----------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OSingleSelectQueryComposer::getQueryWithSubstitution( ) throw (SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getQueryWithSubstitution" ); @@ -1496,7 +1465,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( return sSqlStatement; } -// ----------------------------------------------------------------------------- + ::rtl::OUString OSingleSelectQueryComposer::getStatementPart( TGetParseNode& _aGetFunctor, OSQLParseTreeIterator& _rIterator ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStatementPart" ); @@ -1508,7 +1477,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( return sResult; } -// ----------------------------------------------------------------------------- + namespace { ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,const OPredicateInputController& i_aPredicateInputController,const Reference< XNameAccess >& i_xSelectColumns) @@ -1551,21 +1520,21 @@ namespace return sRet.makeStringAndClear(); } } -// ----------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, ::com::sun::star::lang::IllegalArgumentException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" ); OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); setFilter(lcl_getCondition(filter,aPredicateInput,getColumns())); } -// ----------------------------------------------------------------------------- + void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredHavingClause" ); OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); setHavingClause(lcl_getCondition(filter,aPredicateInput,getColumns())); } -// ----------------------------------------------------------------------------- + void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor,sal_Int32 filterOperator) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setConditionByColumn" ); @@ -1631,7 +1600,6 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert aSQL.append( ::dbtools::quoteName( aQuote, aName ) ); } - if ( aValue.hasValue() ) { if( !m_xTypeConverter.is() ) @@ -1643,7 +1611,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert ::rtl::OUString sEmpty; lcl_addFilterCriteria_throw(filterOperator,sEmpty,aSQL); } - + switch(nType) { case DataType::VARCHAR: @@ -1736,7 +1704,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert // add the filter and the sort order _aSetFunctor(this,sFilter); } -// ----------------------------------------------------------------------------- + Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredCondition( TGetParseNode& _aGetFunctor ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getStructuredCondition" ); @@ -1825,7 +1793,7 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC } return aFilterSeq; } -// ----------------------------------------------------------------------------- + ::rtl::OUString OSingleSelectQueryComposer::getKeyword( SQLPart _ePart ) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getKeyword" ); @@ -1833,7 +1801,7 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC switch(_ePart) { default: - OSL_ENSURE( 0, "OSingleSelectQueryComposer::getKeyWord: Invalid enum value!" ); + OSL_FAIL( "OSingleSelectQueryComposer::getKeyWord: Invalid enum value!" ); // no break, fallback to WHERE case Where: sKeyword = STR_WHERE; @@ -1851,7 +1819,6 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC return sKeyword; } -// ----------------------------------------------------------------------------- ::rtl::OUString OSingleSelectQueryComposer::getSQLPart( SQLPart _ePart, OSQLParseTreeIterator& _rIterator, sal_Bool _bWithKeyword ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::getSQLPart" ); @@ -1872,7 +1839,7 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC F_tmp = TGetParseNode(&OSQLParseTreeIterator::getSimpleOrderTree); break; default: - OSL_ENSURE(0,"Invalid enum value!"); + OSL_FAIL("Invalid enum value!"); } ::rtl::OUString sRet = getStatementPart( F_tmp, _rIterator ); @@ -1880,4 +1847,4 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC sRet = sKeyword + sRet; return sRet; } -// ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx index 7fc52cab1..6668db8f5 100644 --- a/dbaccess/source/core/api/StaticSet.cxx +++ b/dbaccess/source/core/api/StaticSet.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,33 +29,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_CORE_API_STATICSET_HXX #include "StaticSet.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ #include <com/sun/star/sdbcx/CompareBookmark.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ #include <com/sun/star/sdbc/XPreparedStatement.hpp> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #include <connectivity/CommonTools.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif #include <rtl/logfile.hxx> using namespace dbaccess; @@ -62,41 +45,38 @@ using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; -// using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; -// using namespace ::cppu; using namespace ::osl; -// ------------------------------------------------------------------------- void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillValueRow" ); _rRow = *m_aSetIter; } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XRowLocate Any SAL_CALL OStaticSet::getBookmark() throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::getBookmark" ); return makeAny(getRow()); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToBookmark" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return absolute(::comphelper::getINT32(bookmark)); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveRelativeToBookmark" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; return absolute(::comphelper::getINT32(bookmark)+rows); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OStaticSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::compareBookmarks" ); @@ -105,19 +85,19 @@ sal_Int32 SAL_CALL OStaticSet::compareBookmarks( const Any& _first, const Any& _ _second >>= nSecond; return (nFirst < nSecond) ? CompareBookmark::LESS : ((nFirst > nSecond) ? CompareBookmark::GREATER : CompareBookmark::EQUAL); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::hasOrderedBookmarks" ); return sal_True; } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OStaticSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::hashBookmark" ); return ::comphelper::getINT32(bookmark); } -// ------------------------------------------------------------------------- + sal_Bool OStaticSet::fetchRow() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fetchRow" ); @@ -135,7 +115,7 @@ sal_Bool OStaticSet::fetchRow() m_bEnd = sal_True; return bRet; } -// ------------------------------------------------------------------------- + void OStaticSet::fillAllRows() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillAllRows" ); @@ -153,7 +133,7 @@ void OStaticSet::fillAllRows() m_bEnd = sal_True; } } -// ------------------------------------------------------------------------- + // XResultSet sal_Bool SAL_CALL OStaticSet::next( ) throw(SQLException, RuntimeException) { @@ -172,38 +152,38 @@ sal_Bool SAL_CALL OStaticSet::next( ) throw(SQLException, RuntimeException) ++m_aSetIter; return !isAfterLast(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::isBeforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isBeforeFirst" ); return m_aSetIter == m_aSet.begin(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::isAfterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isAfterLast" ); return m_aSetIter == m_aSet.end() && m_bEnd; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::isFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isFirst" ); return m_aSetIter == m_aSet.begin()+1; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::isLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isLast" ); return m_aSetIter == m_aSet.end()-1 && m_bEnd; } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::beforeFirst( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::beforeFirst" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; m_aSetIter = m_aSet.begin(); } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::afterLast( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::afterLast" ); @@ -211,7 +191,7 @@ void SAL_CALL OStaticSet::afterLast( ) throw(SQLException, RuntimeException) fillAllRows(); m_aSetIter = m_aSet.end(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::first( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::first" ); @@ -222,17 +202,17 @@ sal_Bool SAL_CALL OStaticSet::first( ) throw(SQLException, RuntimeException) return m_aSetIter != m_aSet.end(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::last( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::last" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; fillAllRows(); m_aSetIter = m_aSet.end()-1; - + return !isBeforeFirst() && !isAfterLast(); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL OStaticSet::getRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::getRow" ); @@ -243,7 +223,7 @@ sal_Int32 SAL_CALL OStaticSet::getRow( ) throw(SQLException, RuntimeException) OSL_ENSURE(nPos > 0,"RowPos is < 0"); return nPos; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::absolute" ); @@ -273,7 +253,7 @@ sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, Runt bNext = fetchRow(); } - if(row > (sal_Int32)m_aSet.size()) + if(row > (sal_Int32)m_aSet.size()) m_aSetIter = m_aSet.end(); // check again else m_aSetIter = m_aSet.begin() + row; @@ -284,7 +264,7 @@ sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, Runt return m_aSetIter != m_aSet.end() && m_aSetIter != m_aSet.begin(); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::relative" ); @@ -294,41 +274,41 @@ sal_Bool SAL_CALL OStaticSet::relative( sal_Int32 rows ) throw(SQLException, Run sal_Int32 nCurPos = getRow(); return absolute(nCurPos+rows); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::previous( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::previous" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; - + if(m_aSetIter != m_aSet.begin()) --m_aSetIter; return m_aSetIter != m_aSet.begin(); } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::refreshRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::refreshRow" ); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::rowUpdated( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowUpdated" ); return m_bUpdated; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::rowInserted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowInserted" ); return m_bInserted; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OStaticSet::rowDeleted( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowDeleted" ); return m_bDeleted; } -// ------------------------------------------------------------------------- + Sequence< sal_Int32 > SAL_CALL OStaticSet::deleteRows( const Sequence< Any >& rows,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::deleteRows" ); @@ -342,7 +322,7 @@ Sequence< sal_Int32 > SAL_CALL OStaticSet::deleteRows( const Sequence< Any >& ro } return aRet; } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::insertRow" ); @@ -355,13 +335,13 @@ void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connect m_bEnd = sal_False; } } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::updateRow" ); OCacheSet::updateRow( _rInsertRow,_rOrginalRow,_xTable); } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::deleteRow" ); @@ -374,20 +354,19 @@ void SAL_CALL OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connect m_aSet.erase(aPos); } } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::cancelRowUpdates" ); } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToInsertRow" ); } -// ------------------------------------------------------------------------- + void SAL_CALL OStaticSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToCurrentRow" ); } -// ------------------------------------------------------------------------- - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/StaticSet.hxx b/dbaccess/source/core/api/StaticSet.hxx index 82f122086..e5cf8a092 100644 --- a/dbaccess/source/core/api/StaticSet.hxx +++ b/dbaccess/source/core/api/StaticSet.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,9 +29,7 @@ #ifndef DBACCESS_CORE_API_STATICSET_HXX #define DBACCESS_CORE_API_STATICSET_HXX -#ifndef DBACCESS_CORE_API_CACHESET_HXX #include "CacheSet.hxx" -#endif namespace dbaccess { @@ -91,3 +90,4 @@ namespace dbaccess } #endif //DBACCESS_CORE_API_STATICSET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index ee0c02958..13887a786 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -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) { @@ -196,25 +151,25 @@ sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue( case PROPERTY_ID_TEXTLINECOLOR: case PROPERTY_ID_TEXTEMPHASIS: case PROPERTY_ID_TEXTRELIEF: - case PROPERTY_ID_FONTCHARWIDTH: - case PROPERTY_ID_FONTCHARSET: - case PROPERTY_ID_FONTFAMILY: - case PROPERTY_ID_FONTHEIGHT: - case PROPERTY_ID_FONTKERNING: - case PROPERTY_ID_FONTNAME: - case PROPERTY_ID_FONTORIENTATION: - case PROPERTY_ID_FONTPITCH: - case PROPERTY_ID_FONTSLANT: - case PROPERTY_ID_FONTSTRIKEOUT: - case PROPERTY_ID_FONTSTYLENAME: - case PROPERTY_ID_FONTUNDERLINE: - case PROPERTY_ID_FONTWEIGHT: - case PROPERTY_ID_FONTWIDTH: + case PROPERTY_ID_FONTCHARWIDTH: + case PROPERTY_ID_FONTCHARSET: + case PROPERTY_ID_FONTFAMILY: + case PROPERTY_ID_FONTHEIGHT: + case PROPERTY_ID_FONTKERNING: + case PROPERTY_ID_FONTNAME: + case PROPERTY_ID_FONTORIENTATION: + case PROPERTY_ID_FONTPITCH: + case PROPERTY_ID_FONTSLANT: + case PROPERTY_ID_FONTSTRIKEOUT: + case PROPERTY_ID_FONTSTYLENAME: + case PROPERTY_ID_FONTUNDERLINE: + case PROPERTY_ID_FONTWEIGHT: + case PROPERTY_ID_FONTWIDTH: case PROPERTY_ID_FONTWORDLINEMODE: - case PROPERTY_ID_FONTTYPE: + case PROPERTY_ID_FONTTYPE: bRet = ODataSettings::convertFastPropertyValue(rConvertedValue, rOldValue,nHandle,rValue); break; - + default: { Any aValue; @@ -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: @@ -242,22 +197,22 @@ void ODBTableDecorator::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, con case PROPERTY_ID_TEXTLINECOLOR: case PROPERTY_ID_TEXTEMPHASIS: case PROPERTY_ID_TEXTRELIEF: - case PROPERTY_ID_FONTCHARWIDTH: - case PROPERTY_ID_FONTCHARSET: - case PROPERTY_ID_FONTFAMILY: - case PROPERTY_ID_FONTHEIGHT: - case PROPERTY_ID_FONTKERNING: - case PROPERTY_ID_FONTNAME: - case PROPERTY_ID_FONTORIENTATION: - case PROPERTY_ID_FONTPITCH: - case PROPERTY_ID_FONTSLANT: - case PROPERTY_ID_FONTSTRIKEOUT: - case PROPERTY_ID_FONTSTYLENAME: - case PROPERTY_ID_FONTUNDERLINE: - case PROPERTY_ID_FONTWEIGHT: - case PROPERTY_ID_FONTWIDTH: + case PROPERTY_ID_FONTCHARWIDTH: + case PROPERTY_ID_FONTCHARSET: + case PROPERTY_ID_FONTFAMILY: + case PROPERTY_ID_FONTHEIGHT: + case PROPERTY_ID_FONTKERNING: + case PROPERTY_ID_FONTNAME: + case PROPERTY_ID_FONTORIENTATION: + case PROPERTY_ID_FONTPITCH: + case PROPERTY_ID_FONTSLANT: + case PROPERTY_ID_FONTSTRIKEOUT: + case PROPERTY_ID_FONTSTYLENAME: + case PROPERTY_ID_FONTUNDERLINE: + case PROPERTY_ID_FONTWEIGHT: + case PROPERTY_ID_FONTWIDTH: case PROPERTY_ID_FONTWORDLINEMODE: - case PROPERTY_ID_FONTTYPE: + case PROPERTY_ID_FONTTYPE: ODataSettings::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); break; @@ -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: @@ -312,7 +267,7 @@ void ODBTableDecorator::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) c } } // run through - + case PROPERTY_ID_FILTER: case PROPERTY_ID_ORDER: case PROPERTY_ID_APPLYFILTER: @@ -322,22 +277,22 @@ void ODBTableDecorator::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) c case PROPERTY_ID_TEXTLINECOLOR: case PROPERTY_ID_TEXTEMPHASIS: case PROPERTY_ID_TEXTRELIEF: - case PROPERTY_ID_FONTCHARWIDTH: - case PROPERTY_ID_FONTCHARSET: - case PROPERTY_ID_FONTFAMILY: - case PROPERTY_ID_FONTHEIGHT: - case PROPERTY_ID_FONTKERNING: - case PROPERTY_ID_FONTNAME: - case PROPERTY_ID_FONTORIENTATION: - case PROPERTY_ID_FONTPITCH: - case PROPERTY_ID_FONTSLANT: - case PROPERTY_ID_FONTSTRIKEOUT: - case PROPERTY_ID_FONTSTYLENAME: - case PROPERTY_ID_FONTUNDERLINE: - case PROPERTY_ID_FONTWEIGHT: - case PROPERTY_ID_FONTWIDTH: + case PROPERTY_ID_FONTCHARWIDTH: + case PROPERTY_ID_FONTCHARSET: + case PROPERTY_ID_FONTFAMILY: + case PROPERTY_ID_FONTHEIGHT: + case PROPERTY_ID_FONTKERNING: + case PROPERTY_ID_FONTNAME: + case PROPERTY_ID_FONTORIENTATION: + case PROPERTY_ID_FONTPITCH: + case PROPERTY_ID_FONTSLANT: + case PROPERTY_ID_FONTSTRIKEOUT: + case PROPERTY_ID_FONTSTYLENAME: + case PROPERTY_ID_FONTUNDERLINE: + case PROPERTY_ID_FONTWEIGHT: + case PROPERTY_ID_FONTWIDTH: case PROPERTY_ID_FONTWORDLINEMODE: - case PROPERTY_ID_FONTTYPE: + case PROPERTY_ID_FONTTYPE: ODataSettings::getFastPropertyValue(_rValue, _nHandle); break; case PROPERTY_ID_CATALOGNAME: @@ -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,13 +344,12 @@ 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(); - + Sequence< Property > aTableProps = xInfo->getProperties(); Property* pIter = aTableProps.getArray(); Property* pEnd = pIter + aTableProps.getLength(); @@ -416,13 +370,12 @@ void ODBTableDecorator::construct() } describeProperties(aTableProps); - - return new ::cppu::OPropertyArrayHelper(aTableProps); + + return new ::cppu::OPropertyArrayHelper(aTableProps); } -// ----------------------------------------------------------------------------- -::cppu::IPropertyArrayHelper & SAL_CALL ODBTableDecorator::getInfoHelper() + +::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,39 +391,35 @@ 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()) { aRet = m_xTable->queryInterface(rType); - if(aRet.hasValue()) + if(aRet.hasValue()) { // now we know that our table supports this type so we return ourself aRet = OTableDescriptor_BASE::queryInterface(rType); if(!aRet.hasValue()) - aRet = ODataSettings::queryInterface(rType); + aRet = ODataSettings::queryInterface(rType); } } 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" ); @@ -654,7 +598,7 @@ void ODBTableDecorator::refreshColumns() ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); ::std::vector< ::rtl::OUString> aVector; - + Reference<XNameAccess> xNames; if(m_xTable.is()) { @@ -679,12 +623,12 @@ void ODBTableDecorator::refreshColumns() OContainerMediator* pMediator = new OContainerMediator( pCol, m_xColumnDefinitions, m_xConnection, OContainerMediator::eColumns ); m_xColumnMediator = pMediator; pCol->setMediator( pMediator ); - m_pColumns = pCol; + m_pColumns = pCol; } 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: */ diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx index 3644c4f42..561482989 100644 --- a/dbaccess/source/core/api/View.cxx +++ b/dbaccess/source/core/api/View.cxx @@ -1,14 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: View.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -47,10 +45,8 @@ #include <tools/diagnose_ex.h> #include <unotools/sharedunocomponent.hxx> -//........................................................................ namespace dbaccess { -//........................................................................ /** === begin UNO using === **/ using namespace ::com::sun::star::uno; @@ -78,7 +74,6 @@ namespace dbaccess //==================================================================== //= View //==================================================================== - //-------------------------------------------------------------------- View::View( const Reference< XConnection >& _rxConnection, sal_Bool _bCaseSensitive, const ::rtl::OUString& _rCatalogName,const ::rtl::OUString& _rSchemaName, const ::rtl::OUString& _rName ) :View_Base( _bCaseSensitive, _rName, _rxConnection->getMetaData(), 0, ::rtl::OUString(), _rSchemaName, _rCatalogName ) @@ -96,15 +91,13 @@ namespace dbaccess } } - //-------------------------------------------------------------------- View::~View() { } - //-------------------------------------------------------------------- IMPLEMENT_FORWARD_REFCOUNT( View, View_Base ) IMPLEMENT_GET_IMPLEMENTATION_ID( View ) - // ------------------------------------------------------------------------- + Any SAL_CALL View::queryInterface( const Type & _rType ) throw(RuntimeException) { if(_rType == getCppuType( (Reference<XAlterView>*)0) && !m_xViewAccess.is() ) @@ -114,14 +107,14 @@ namespace dbaccess aReturn = View_IBASE::queryInterface( _rType ); return aReturn; } - // ------------------------------------------------------------------------- + Sequence< Type > SAL_CALL View::getTypes( ) throw(RuntimeException) { Type aAlterType = getCppuType( (Reference<XAlterView>*)0); Sequence< Type > aTypes( ::comphelper::concatSequences(View_Base::getTypes(),View_IBASE::getTypes()) ); ::std::vector<Type> aOwnTypes; - aOwnTypes.reserve(aTypes.getLength()); + aOwnTypes.reserve(aTypes.getLength()); const Type* pIter = aTypes.getConstArray(); const Type* pEnd = pIter + aTypes.getLength(); @@ -130,19 +123,17 @@ namespace dbaccess if( (*pIter != aAlterType || m_xViewAccess.is()) ) aOwnTypes.push_back(*pIter); } - + Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; return Sequence< Type >(pTypes, aOwnTypes.size()); } - //-------------------------------------------------------------------- void SAL_CALL View::alterCommand( const ::rtl::OUString& _rNewCommand ) throw (SQLException, RuntimeException) { OSL_ENSURE(m_xViewAccess.is(),"Illegal call to AlterView!"); m_xViewAccess->alterCommand(this,_rNewCommand); } - //-------------------------------------------------------------------- void SAL_CALL View::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const { if ( _nHandle == m_nCommandHandle && m_xViewAccess.is() ) @@ -155,7 +146,6 @@ namespace dbaccess View_Base::getFastPropertyValue( _rValue, _nHandle ); } - // ----------------------------------------------------------------------------- -//........................................................................ + } // namespace dbaccess -//........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/WrappedResultSet.cxx b/dbaccess/source/core/api/WrappedResultSet.cxx index 0b9c6b6c2..794015333 100644 --- a/dbaccess/source/core/api/WrappedResultSet.cxx +++ b/dbaccess/source/core/api/WrappedResultSet.cxx @@ -1,14 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: BookmarkSet.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -45,11 +43,9 @@ using namespace ::dbtools; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; -// using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; -// using namespace ::cppu; using namespace ::osl; void WrappedResultSet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter) @@ -60,7 +56,7 @@ void WrappedResultSet::construct(const Reference< XResultSet>& _xDriverSet,const m_xRowLocate.set(_xDriverSet,UNO_QUERY_THROW); m_xUpdRow.set(_xDriverSet,UNO_QUERY_THROW); } -// ----------------------------------------------------------------------------- + Any SAL_CALL WrappedResultSet::getBookmark() throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::getBookmark" ); @@ -70,37 +66,37 @@ Any SAL_CALL WrappedResultSet::getBookmark() throw(SQLException, RuntimeExceptio } return makeAny(m_xDriverSet->getRow()); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL WrappedResultSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::moveToBookmark" ); return m_xRowLocate->moveToBookmark( bookmark ); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL WrappedResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::moveRelativeToBookmark" ); return m_xRowLocate->moveRelativeToBookmark( bookmark,rows ); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL WrappedResultSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::compareBookmarks" ); return m_xRowLocate->compareBookmarks( _first,_second ); } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL WrappedResultSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::hasOrderedBookmarks" ); return m_xRowLocate->hasOrderedBookmarks(); } -// ------------------------------------------------------------------------- + sal_Int32 SAL_CALL WrappedResultSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::hashBookmark" ); return m_xRowLocate->hashBookmark(bookmark); } -// ------------------------------------------------------------------------- + // ::com::sun::star::sdbcx::XDeleteRows Sequence< sal_Int32 > SAL_CALL WrappedResultSet::deleteRows( const Sequence< Any >& rows ,const connectivity::OSQLTable& /*_xTable*/) throw(SQLException, RuntimeException) { @@ -112,7 +108,7 @@ Sequence< sal_Int32 > SAL_CALL WrappedResultSet::deleteRows( const Sequence< Any } return Sequence< sal_Int32 >(); } -// ------------------------------------------------------------------------- + void SAL_CALL WrappedResultSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::insertRow" ); @@ -128,7 +124,7 @@ void SAL_CALL WrappedResultSet::insertRow( const ORowSetRow& _rInsertRow,const c m_xUpd->insertRow(); (*_rInsertRow->get().begin()) = getBookmark(); } -// ------------------------------------------------------------------------- + void SAL_CALL WrappedResultSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::updateRow" ); @@ -142,37 +138,37 @@ void SAL_CALL WrappedResultSet::updateRow(const ORowSetRow& _rInsertRow ,const O } m_xUpd->updateRow(); } -// ------------------------------------------------------------------------- + void SAL_CALL WrappedResultSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::deleteRow" ); m_xUpd->deleteRow(); } -// ------------------------------------------------------------------------- + void SAL_CALL WrappedResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::cancelRowUpdates" ); m_xUpd->cancelRowUpdates(); } -// ------------------------------------------------------------------------- + void SAL_CALL WrappedResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::moveToInsertRow" ); m_xUpd->moveToInsertRow(); } -// ------------------------------------------------------------------------- + void SAL_CALL WrappedResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::moveToCurrentRow" ); m_xUpd->moveToCurrentRow(); } -// ------------------------------------------------------------------------- + void WrappedResultSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::fillValueRow" ); OCacheSet::fillValueRow(_rRow,_nPosition); } -// ------------------------------------------------------------------------- + void WrappedResultSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xParameter,const ORowSetValue& _rValue) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "WrappedResultSet::updateColumn" ); @@ -191,8 +187,6 @@ void WrappedResultSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xPar break; case DataType::CHAR: case DataType::VARCHAR: - //case DataType::DECIMAL: - //case DataType::NUMERIC: _xParameter->updateString(nPos,_rValue); break; case DataType::BIGINT: @@ -252,4 +246,4 @@ void WrappedResultSet::updateColumn(sal_Int32 nPos,Reference< XRowUpdate > _xPar } } } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/WrappedResultSet.hxx b/dbaccess/source/core/api/WrappedResultSet.hxx index 7b9f17c68..8765a183a 100644 --- a/dbaccess/source/core/api/WrappedResultSet.hxx +++ b/dbaccess/source/core/api/WrappedResultSet.hxx @@ -1,14 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: BookmarkSet.hxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,9 +29,7 @@ #ifndef DBACCESS_CORE_API_WRAPPEDRESULTSET_HXX #define DBACCESS_CORE_API_WRAPPEDRESULTSET_HXX -#ifndef DBACCESS_CORE_API_CACHESET_HXX #include "CacheSet.hxx" -#endif #include <com/sun/star/sdbc/XRowUpdate.hpp> #include <com/sun/star/sdbc/XResultSetUpdate.hpp> @@ -77,3 +73,4 @@ namespace dbaccess } #endif // DBACCESS_CORE_API_WRAPPEDRESULTSET_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/callablestatement.cxx b/dbaccess/source/core/api/callablestatement.cxx index 8398c4eb9..4f052bdf4 100644 --- a/dbaccess/source/core/api/callablestatement.cxx +++ b/dbaccess/source/core/api/callablestatement.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,24 +28,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_COREAPI_CALLABLESTATEMENT_HXX_ #include <callablestatement.hxx> -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX //autogen #include <tools/debug.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif #include <rtl/logfile.hxx> using namespace dbaccess; @@ -57,7 +46,6 @@ using namespace ::cppu; using namespace ::osl; // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > OCallableStatement::getTypes() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getTypes" ); @@ -68,7 +56,6 @@ Sequence< Type > OCallableStatement::getTypes() throw (RuntimeException) return aTypes.getTypes(); } -//-------------------------------------------------------------------------- Sequence< sal_Int8 > OCallableStatement::getImplementationId() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getImplementationId" ); @@ -86,7 +73,6 @@ Sequence< sal_Int8 > OCallableStatement::getImplementationId() throw (RuntimeExc } // com::sun::star::uno::XInterface -//-------------------------------------------------------------------------- Any OCallableStatement::queryInterface( const Type & rType ) throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::queryInterface" ); @@ -99,27 +85,23 @@ Any OCallableStatement::queryInterface( const Type & rType ) throw (RuntimeExcep return aIface; } -//-------------------------------------------------------------------------- void OCallableStatement::acquire() throw () { OPreparedStatement::acquire(); } -//-------------------------------------------------------------------------- void OCallableStatement::release() throw () { OPreparedStatement::release(); } // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OCallableStatement::getImplementationName( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getImplementationName" ); - return rtl::OUString::createFromAscii("com.sun.star.sdb.OCallableStatement"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OCallableStatement")); } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OCallableStatement::getSupportedServiceNames( ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getSupportedServiceNames" ); @@ -130,19 +112,16 @@ Sequence< ::rtl::OUString > OCallableStatement::getSupportedServiceNames( ) thr } // XOutParameters -//------------------------------------------------------------------------------ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::registerOutParameter" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed); - Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY)->registerOutParameter( parameterIndex, sqlType, typeName ); } -//------------------------------------------------------------------------------ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::registerNumericOutParameter" ); @@ -153,7 +132,6 @@ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 paramet } // XRow -//------------------------------------------------------------------------------ sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::wasNull" ); @@ -163,7 +141,6 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeExc return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->wasNull(); } -//------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getString" ); @@ -173,7 +150,6 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeExc return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getString( columnIndex ); } -//------------------------------------------------------------------------------ sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBoolean" ); @@ -183,7 +159,6 @@ sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw( return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBoolean( columnIndex ); } -//------------------------------------------------------------------------------ sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getByte" ); @@ -193,7 +168,6 @@ sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQL return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getByte( columnIndex ); } -//------------------------------------------------------------------------------ sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getShort" ); @@ -202,7 +176,6 @@ sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(S return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getShort( columnIndex ); } -//------------------------------------------------------------------------------ sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getInt" ); @@ -211,7 +184,6 @@ sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQL return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getInt( columnIndex ); } -//------------------------------------------------------------------------------ sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getLong" ); @@ -220,7 +192,6 @@ sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQ return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getLong( columnIndex ); } -//------------------------------------------------------------------------------ float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getFloat" ); @@ -229,7 +200,6 @@ float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLEx return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getFloat( columnIndex ); } -//------------------------------------------------------------------------------ double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getDouble" ); @@ -238,7 +208,6 @@ double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQL return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getDouble( columnIndex ); } -//------------------------------------------------------------------------------ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBytes" ); @@ -247,7 +216,6 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBytes( columnIndex ); } -//------------------------------------------------------------------------------ ::com::sun::star::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getDate" ); @@ -256,7 +224,6 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getDate( columnIndex ); } -//------------------------------------------------------------------------------ ::com::sun::star::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getTime" ); @@ -265,7 +232,6 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getTime( columnIndex ); } -//------------------------------------------------------------------------------ ::com::sun::star::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getTimestamp" ); @@ -275,7 +241,6 @@ Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnInde return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getTimestamp( columnIndex ); } -//------------------------------------------------------------------------------ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBinaryStream" ); @@ -285,7 +250,6 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::get return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBinaryStream( columnIndex ); } -//------------------------------------------------------------------------------ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getCharacterStream" ); @@ -295,7 +259,6 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::get return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getCharacterStream( columnIndex ); } -//------------------------------------------------------------------------------ Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getObject" ); @@ -305,7 +268,6 @@ Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Referen return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getObject( columnIndex, typeMap ); } -//------------------------------------------------------------------------------ Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getRef" ); @@ -314,7 +276,6 @@ Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex ) t return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getRef( columnIndex ); } -//------------------------------------------------------------------------------ Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getBlob" ); @@ -323,7 +284,6 @@ Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex ) return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBlob( columnIndex ); } -//------------------------------------------------------------------------------ Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getClob" ); @@ -332,7 +292,6 @@ Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex ) return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getClob( columnIndex ); } -//------------------------------------------------------------------------------ Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCallableStatement::getArray" ); @@ -342,3 +301,4 @@ Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx index 43412bb02..d86f9798d 100644 --- a/dbaccess/source/core/api/column.cxx +++ b/dbaccess/source/core/api/column.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -77,7 +78,6 @@ DBG_NAME(OColumn) //============================================================ //= OColumn //============================================================ -//-------------------------------------------------------------------------- OColumn::OColumn( const bool _bNameIsReadOnly ) :OColumnBase( m_aMutex ) ,::comphelper::OPropertyContainer( OColumnBase::rBHelper ) @@ -88,14 +88,12 @@ OColumn::OColumn( const bool _bNameIsReadOnly ) &m_sName, ::getCppuType( &m_sName ) ); } -//-------------------------------------------------------------------------- OColumn::~OColumn() { DBG_DTOR(OColumn, NULL); } // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > OColumn::getTypes() throw (RuntimeException) { return ::comphelper::concatSequences( @@ -108,19 +106,16 @@ Sequence< Type > OColumn::getTypes() throw (RuntimeException) IMPLEMENT_FORWARD_XINTERFACE2( OColumn, OColumnBase, ::comphelper::OPropertyContainer ) // ::com::sun::star::lang::XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OColumn::getImplementationName( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.OColumn"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OColumn")); } -//------------------------------------------------------------------------------ sal_Bool OColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OColumn::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 1 ); @@ -129,49 +124,42 @@ Sequence< ::rtl::OUString > OColumn::getSupportedServiceNames( ) throw (Runtime } // OComponentHelper -//------------------------------------------------------------------------------ void OColumn::disposing() { OPropertyContainer::disposing(); } // com::sun::star::beans::XPropertySet -//------------------------------------------------------------------------------ Reference< XPropertySetInfo > OColumn::getPropertySetInfo() throw (RuntimeException) { return createPropertySetInfo( getInfoHelper() ) ; } -// ----------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OColumn::getName( ) throw(::com::sun::star::uno::RuntimeException) { return m_sName; } -// ----------------------------------------------------------------------------- + void SAL_CALL OColumn::setName( const ::rtl::OUString& _rName ) throw(::com::sun::star::uno::RuntimeException) { m_sName = _rName; } -// ----------------------------------------------------------------------------- void OColumn::fireValueChange(const ::connectivity::ORowSetValue& /*_rOldValue*/) { - DBG_ERROR( "OColumn::fireValueChange: not implemented!" ); + OSL_FAIL( "OColumn::fireValueChange: not implemented!" ); } -//------------------------------------------------------------------------------ void OColumn::registerProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void* _pPointerToMember, const Type& _rMemberType ) { ::comphelper::OPropertyContainer::registerProperty( _rName, _nHandle, _nAttributes, _pPointerToMember, _rMemberType ); } -//------------------------------------------------------------------------------ void OColumn::registerMayBeVoidProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, Any* _pPointerToMember, const Type& _rExpectedType ) { ::comphelper::OPropertyContainer::registerMayBeVoidProperty( _rName, _nHandle, _nAttributes, _pPointerToMember, _rExpectedType ); } -//------------------------------------------------------------------------------ void OColumn::registerPropertyNoMember( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const Type& _rType, const void* _pInitialValue ) { ::comphelper::OPropertyContainer::registerPropertyNoMember( _rName, _nHandle, _nAttributes, _rType, _pInitialValue ); @@ -182,7 +170,6 @@ void OColumn::registerPropertyNoMember( const ::rtl::OUString& _rName, sal_Int32 //============================================================ DBG_NAME(OColumns); -//-------------------------------------------------------------------------- OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, sal_Bool _bCaseSensitive,const ::std::vector< ::rtl::OUString> &_rVector, @@ -203,7 +190,6 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent, DBG_CTOR(OColumns, NULL); } -// ------------------------------------------------------------------------- OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxDrvColumns, sal_Bool _bCaseSensitive,const ::std::vector< ::rtl::OUString> &_rVector, @@ -223,26 +209,23 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, { DBG_CTOR(OColumns, NULL); } -//-------------------------------------------------------------------------- + OColumns::~OColumns() { DBG_DTOR(OColumns, NULL); } // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OColumns::getImplementationName( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.OColumns"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OColumns")); } -//------------------------------------------------------------------------------ sal_Bool OColumns::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OColumns::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 1 ); @@ -271,7 +254,6 @@ void OColumns::clearColumns() disposing(); } -// ----------------------------------------------------------------------------- void SAL_CALL OColumns::disposing(void) { MutexGuard aGuard(m_rMutex); @@ -281,14 +263,12 @@ void SAL_CALL OColumns::disposing(void) OColumns_BASE::disposing(); } -// ------------------------------------------------------------------------- void OColumns::impl_refresh() throw(::com::sun::star::uno::RuntimeException) { if (m_pRefreshColumns) m_pRefreshColumns->refreshColumns(); } -// ------------------------------------------------------------------------- connectivity::sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) { OSL_ENSURE(m_pColFactoryImpl, "OColumns::createObject: no column factory!"); @@ -308,7 +288,7 @@ connectivity::sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _r return xRet; } -// ------------------------------------------------------------------------- + Reference< XPropertySet > OColumns::createDescriptor() { if ( m_pColFactoryImpl ) @@ -322,16 +302,16 @@ Reference< XPropertySet > OColumns::createDescriptor() else return Reference< XPropertySet >(); } -// ------------------------------------------------------------------------- + Any SAL_CALL OColumns::queryInterface( const Type & rType ) throw(RuntimeException) { Any aRet; if(m_xDrvColumns.is()) { aRet = m_xDrvColumns->queryInterface(rType); - if ( aRet.hasValue() ) + if ( aRet.hasValue() ) aRet = OColumns_BASE::queryInterface( rType); - if ( !aRet.hasValue() ) + if ( !aRet.hasValue() ) aRet = TXChild::queryInterface( rType); return aRet; } @@ -344,11 +324,11 @@ Any SAL_CALL OColumns::queryInterface( const Type & rType ) throw(RuntimeExcepti } aRet = OColumns_BASE::queryInterface( rType); - if ( !aRet.hasValue() ) + if ( !aRet.hasValue() ) aRet = TXChild::queryInterface( rType); return aRet; } -// ------------------------------------------------------------------------- + Sequence< Type > SAL_CALL OColumns::getTypes( ) throw(RuntimeException) { sal_Bool bAppendFound = sal_False,bDropFound = sal_False; @@ -399,7 +379,7 @@ Sequence< Type > SAL_CALL OColumns::getTypes( ) throw(RuntimeException) } return aRet; } -// ------------------------------------------------------------------------- + // XAppend sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { @@ -437,7 +417,7 @@ sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString& _rForName, cons return xReturn; } -// ------------------------------------------------------------------------- + // XDrop void OColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { @@ -465,17 +445,16 @@ void OColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) ::dbaccess::notifyDataSourceModified(m_xParent,sal_True); } -// ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL OColumns::getParent( ) throw (RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); return m_xParent; } -// ----------------------------------------------------------------------------- + void SAL_CALL OColumns::setParent( const Reference< XInterface >& _xParent ) throw (NoSupportException, RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); m_xParent = _xParent; } -// ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx index 1650d068a..985a252cd 100644 --- a/dbaccess/source/core/api/columnsettings.cxx +++ b/dbaccess/source/core/api/columnsettings.cxx @@ -1,6 +1,7 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,6 +39,7 @@ #include <comphelper/property.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> //........................................................................ namespace dbaccess @@ -66,20 +68,18 @@ namespace dbaccess //= OColumnSettings //============================================================================== DBG_NAME( OColumnSettings ) - //------------------------------------------------------------------------------ + OColumnSettings::OColumnSettings() :m_bHidden(sal_False) { DBG_CTOR( OColumnSettings, NULL ); } - //------------------------------------------------------------------------------ OColumnSettings::~OColumnSettings() { DBG_DTOR( OColumnSettings, NULL ); } - //------------------------------------------------------------------------------ void OColumnSettings::registerProperties( IPropertyContainer& _rPropertyContainer ) { const sal_Int32 nBoundAttr = PropertyAttribute::BOUND; @@ -98,7 +98,6 @@ namespace dbaccess _rPropertyContainer.registerProperty( PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN, nBoundAttr, &m_bHidden, ::getCppuType( &m_bHidden ) ); } - //------------------------------------------------------------------------------ bool OColumnSettings::isColumnSettingProperty( const sal_Int32 _nPropertyHandle ) { return ( _nPropertyHandle == PROPERTY_ID_ALIGN ) @@ -111,7 +110,6 @@ namespace dbaccess || ( _nPropertyHandle == PROPERTY_ID_HIDDEN ); } - //------------------------------------------------------------------------------ bool OColumnSettings::isDefaulted( const sal_Int32 _nPropertyHandle, const Any& _rPropertyValue ) { switch ( _nPropertyHandle ) @@ -134,11 +132,10 @@ namespace dbaccess return !bHidden; } } - OSL_ENSURE( false, "OColumnSettings::isDefaulted: illegal property handle!" ); + OSL_FAIL( "OColumnSettings::isDefaulted: illegal property handle!" ); return sal_False; } - //------------------------------------------------------------------------------ bool OColumnSettings::hasDefaultSettings( const Reference< XPropertySet >& _rxColumn ) { ENSURE_OR_THROW( _rxColumn.is(), "illegal column" ); @@ -163,7 +160,7 @@ namespace dbaccess { PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN } }; - for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) { if ( xPSI->hasPropertyByName( aProps[i].sName ) ) if ( !isDefaulted( aProps[i].nHandle, _rxColumn->getPropertyValue( aProps[i].sName ) ) ) @@ -180,3 +177,5 @@ namespace dbaccess //........................................................................ } // namespace dbaccess //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/datacolumn.cxx b/dbaccess/source/core/api/datacolumn.cxx index e7bb442c8..bca1cadfc 100644 --- a/dbaccess/source/core/api/datacolumn.cxx +++ b/dbaccess/source/core/api/datacolumn.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,33 +28,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBACORE_DATACOLUMN_HXX_ #include "datacolumn.hxx" -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif using namespace dbaccess; using namespace ::com::sun::star::sdbc; @@ -67,7 +50,7 @@ using namespace ::comphelper; using namespace ::cppu; DBG_NAME(ODataColumn) -//-------------------------------------------------------------------------- + ODataColumn::ODataColumn( const Reference < XResultSetMetaData >& _xMetaData, const Reference < XRow >& _xRow, @@ -80,14 +63,13 @@ ODataColumn::ODataColumn( { DBG_CTOR(ODataColumn,NULL); } -// ----------------------------------------------------------------------------- + ODataColumn::~ODataColumn() { DBG_DTOR(ODataColumn,NULL); } // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > ODataColumn::getTypes() throw (RuntimeException) { OTypeCollection aTypes(::getCppuType( (const Reference< XColumn > *)0 ), @@ -96,7 +78,6 @@ Sequence< Type > ODataColumn::getTypes() throw (RuntimeException) return aTypes.getTypes(); } -//-------------------------------------------------------------------------- Sequence< sal_Int8 > ODataColumn::getImplementationId() throw (RuntimeException) { static OImplementationId * pId = 0; @@ -112,7 +93,6 @@ Sequence< sal_Int8 > ODataColumn::getImplementationId() throw (RuntimeException) return pId->getImplementationId(); } -//------------------------------------------------------------------------------ Any SAL_CALL ODataColumn::queryInterface( const Type & _rType ) throw (RuntimeException) { Any aReturn = OResultColumn::queryInterface(_rType); @@ -125,13 +105,11 @@ Any SAL_CALL ODataColumn::queryInterface( const Type & _rType ) throw (RuntimeEx } // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString ODataColumn::getImplementationName( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.ODataColumn"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ODataColumn")); } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ODataColumn::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 3 ); @@ -142,7 +120,6 @@ Sequence< ::rtl::OUString > ODataColumn::getSupportedServiceNames( ) throw (Run } // OComponentHelper -//------------------------------------------------------------------------------ void ODataColumn::disposing() { OResultColumn::disposing(); @@ -152,16 +129,14 @@ void ODataColumn::disposing() } // ::com::sun::star::sdb::XColumn -//------------------------------------------------------------------------------ sal_Bool ODataColumn::wasNull(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(!m_xRow.is()); - + return m_xRow->wasNull(); } -//------------------------------------------------------------------------------ rtl::OUString ODataColumn::getString(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -170,7 +145,6 @@ rtl::OUString ODataColumn::getString(void) throw( SQLException, RuntimeException return m_xRow->getString(m_nPos); } -//------------------------------------------------------------------------------ sal_Bool ODataColumn::getBoolean(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -179,7 +153,6 @@ sal_Bool ODataColumn::getBoolean(void) throw( SQLException, RuntimeException ) return m_xRow->getBoolean(m_nPos); } -//------------------------------------------------------------------------------ sal_Int8 ODataColumn::getByte(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -188,7 +161,6 @@ sal_Int8 ODataColumn::getByte(void) throw( SQLException, RuntimeException ) return m_xRow->getByte(m_nPos); } -//------------------------------------------------------------------------------ sal_Int16 ODataColumn::getShort(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -197,7 +169,6 @@ sal_Int16 ODataColumn::getShort(void) throw( SQLException, RuntimeException ) return m_xRow->getShort(m_nPos); } -//------------------------------------------------------------------------------ sal_Int32 ODataColumn::getInt(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -206,7 +177,6 @@ sal_Int32 ODataColumn::getInt(void) throw( SQLException, RuntimeException ) return m_xRow->getInt(m_nPos); } -//------------------------------------------------------------------------------ sal_Int64 ODataColumn::getLong(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -215,7 +185,6 @@ sal_Int64 ODataColumn::getLong(void) throw( SQLException, RuntimeException ) return m_xRow->getLong(m_nPos); } -//------------------------------------------------------------------------------ float ODataColumn::getFloat(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -223,7 +192,7 @@ float ODataColumn::getFloat(void) throw( SQLException, RuntimeException ) return m_xRow->getFloat(m_nPos); } -//------------------------------------------------------------------------------ + double ODataColumn::getDouble(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -232,7 +201,6 @@ double ODataColumn::getDouble(void) throw( SQLException, RuntimeException ) return m_xRow->getDouble(m_nPos); } -//------------------------------------------------------------------------------ Sequence< sal_Int8 > ODataColumn::getBytes(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -240,7 +208,7 @@ Sequence< sal_Int8 > ODataColumn::getBytes(void) throw( SQLException, RuntimeExc return m_xRow->getBytes(m_nPos); } -//------------------------------------------------------------------------------ + com::sun::star::util::Date ODataColumn::getDate(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -249,7 +217,6 @@ com::sun::star::util::Date ODataColumn::getDate(void) throw( SQLException, Runti return m_xRow->getDate(m_nPos); } -//------------------------------------------------------------------------------ com::sun::star::util::Time ODataColumn::getTime(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -257,7 +224,7 @@ com::sun::star::util::Time ODataColumn::getTime(void) throw( SQLException, Runti return m_xRow->getTime(m_nPos); } -//------------------------------------------------------------------------------ + com::sun::star::util::DateTime ODataColumn::getTimestamp(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -266,7 +233,6 @@ com::sun::star::util::DateTime ODataColumn::getTimestamp(void) throw( SQLExcepti return m_xRow->getTimestamp(m_nPos); } -//------------------------------------------------------------------------------ Reference< ::com::sun::star::io::XInputStream > ODataColumn::getBinaryStream(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -275,7 +241,6 @@ Reference< ::com::sun::star::io::XInputStream > ODataColumn::getBinaryStream(vo return m_xRow->getBinaryStream(m_nPos); } -//------------------------------------------------------------------------------ Reference< ::com::sun::star::io::XInputStream > ODataColumn::getCharacterStream(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -284,7 +249,6 @@ Reference< ::com::sun::star::io::XInputStream > ODataColumn::getCharacterStream return m_xRow->getCharacterStream(m_nPos); } -//------------------------------------------------------------------------------ Any ODataColumn::getObject(const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -293,7 +257,6 @@ Any ODataColumn::getObject(const Reference< ::com::sun::star::container::XNameAc return m_xRow->getObject(m_nPos, typeMap); } -//------------------------------------------------------------------------------ Reference< XRef > ODataColumn::getRef(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -302,7 +265,6 @@ Reference< XRef > ODataColumn::getRef(void) throw( SQLException, RuntimeExcepti return m_xRow->getRef(m_nPos); } -//------------------------------------------------------------------------------ Reference< XBlob > ODataColumn::getBlob(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -311,7 +273,6 @@ Reference< XBlob > ODataColumn::getBlob(void) throw( SQLException, RuntimeExcep return m_xRow->getBlob(m_nPos); } -//------------------------------------------------------------------------------ Reference< XClob > ODataColumn::getClob(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -320,7 +281,6 @@ Reference< XClob > ODataColumn::getClob(void) throw( SQLException, RuntimeExcep return m_xRow->getClob(m_nPos); } -//------------------------------------------------------------------------------ Reference< XArray > ODataColumn::getArray(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -330,7 +290,6 @@ Reference< XArray > ODataColumn::getArray(void) throw( SQLException, RuntimeExc } // ::com::sun::star::sdb::XColumnUpdate -//------------------------------------------------------------------------------ void ODataColumn::updateNull(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -339,7 +298,6 @@ void ODataColumn::updateNull(void) throw( SQLException, RuntimeException ) m_xRowUpdate->updateNull(m_nPos); } -//------------------------------------------------------------------------------ void ODataColumn::updateBoolean(sal_Bool x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -348,7 +306,6 @@ void ODataColumn::updateBoolean(sal_Bool x) throw( SQLException, RuntimeExceptio m_xRowUpdate->updateBoolean(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateByte(sal_Int8 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -357,7 +314,6 @@ void ODataColumn::updateByte(sal_Int8 x) throw( SQLException, RuntimeException ) m_xRowUpdate->updateByte(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateShort(sal_Int16 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -366,7 +322,6 @@ void ODataColumn::updateShort(sal_Int16 x) throw( SQLException, RuntimeException m_xRowUpdate->updateShort(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateInt(sal_Int32 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -375,7 +330,6 @@ void ODataColumn::updateInt(sal_Int32 x) throw( SQLException, RuntimeException ) m_xRowUpdate->updateInt(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateLong(sal_Int64 x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -384,7 +338,6 @@ void ODataColumn::updateLong(sal_Int64 x) throw( SQLException, RuntimeException m_xRowUpdate->updateLong(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateFloat(float x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -393,7 +346,6 @@ void ODataColumn::updateFloat(float x) throw( SQLException, RuntimeException ) m_xRowUpdate->updateFloat(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateDouble(double x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -402,7 +354,6 @@ void ODataColumn::updateDouble(double x) throw( SQLException, RuntimeException ) m_xRowUpdate->updateDouble(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateString(const rtl::OUString& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -411,7 +362,6 @@ void ODataColumn::updateString(const rtl::OUString& x) throw( SQLException, Runt m_xRowUpdate->updateString(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateBytes(const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -420,7 +370,6 @@ void ODataColumn::updateBytes(const Sequence< sal_Int8 >& x) throw( SQLException m_xRowUpdate->updateBytes(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateDate(const com::sun::star::util::Date& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -429,7 +378,6 @@ void ODataColumn::updateDate(const com::sun::star::util::Date& x) throw( SQLExce m_xRowUpdate->updateDate(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateTime(const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -438,7 +386,6 @@ void ODataColumn::updateTime(const ::com::sun::star::util::Time& x) throw( SQLEx m_xRowUpdate->updateTime(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateTimestamp(const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -447,7 +394,6 @@ void ODataColumn::updateTimestamp(const ::com::sun::star::util::DateTime& x) thr m_xRowUpdate->updateTimestamp(m_nPos, x); } -//------------------------------------------------------------------------------ void ODataColumn::updateCharacterStream(const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -456,7 +402,6 @@ void ODataColumn::updateCharacterStream(const Reference< ::com::sun::star::io::X m_xRowUpdate->updateCharacterStream(m_nPos, x, length); } -//------------------------------------------------------------------------------ void ODataColumn::updateBinaryStream(const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -465,7 +410,6 @@ void ODataColumn::updateBinaryStream(const Reference< ::com::sun::star::io::XInp m_xRowUpdate->updateBinaryStream(m_nPos, x, length); } -//------------------------------------------------------------------------------ void ODataColumn::updateNumericObject(const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); @@ -474,12 +418,11 @@ void ODataColumn::updateNumericObject(const Any& x, sal_Int32 scale) throw( SQLE m_xRowUpdate->updateNumericObject(m_nPos, x, scale); } -//------------------------------------------------------------------------------ void ODataColumn::updateObject(const Any& x) throw( SQLException, RuntimeException ) { MutexGuard aGuard( m_aMutex ); ::connectivity::checkDisposed(!m_xRowUpdate.is()); - + m_xRowUpdate->updateObject(m_nPos, x); } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/datacolumn.hxx b/dbaccess/source/core/api/datacolumn.hxx index c55c9e77c..40a0a047a 100644 --- a/dbaccess/source/core/api/datacolumn.hxx +++ b/dbaccess/source/core/api/datacolumn.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,24 +29,12 @@ #ifndef _DBACORE_DATACOLUMN_HXX_ #define _DBACORE_DATACOLUMN_HXX_ -#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ #include <com/sun/star/sdbc/XRowUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HDL_ #include <com/sun/star/sdbc/XResultSetMetaData.hdl> -#endif -#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_ #include <com/sun/star/sdb/XColumn.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XCOLUMNUPDATE_HPP_ #include <com/sun/star/sdb/XColumnUpdate.hpp> -#endif -#ifndef _DBA_COREAPI_RESULTCOLUMN_HXX_ #include <resultcolumn.hxx> -#endif namespace dbaccess { //************************************************************ @@ -127,3 +116,4 @@ namespace dbaccess } #endif // _DBACORE_RESULTCOLUMN_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/datasettings.cxx b/dbaccess/source/core/api/datasettings.cxx index e2d766645..085f99ecf 100644 --- a/dbaccess/source/core/api/datasettings.cxx +++ b/dbaccess/source/core/api/datasettings.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,43 +29,19 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_CORE_DATASETTINGS_HXX_ #include "datasettings.hxx" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_ #include <com/sun/star/awt/FontWeight.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTEMPHASISMARK_HPP_ #include <com/sun/star/awt/FontEmphasisMark.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTRELIEF_HPP_ #include <com/sun/star/awt/FontRelief.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_ #include <com/sun/star/awt/FontWidth.hpp> -#endif using namespace ::com::sun::star::uno; @@ -74,13 +51,11 @@ using namespace ::com::sun::star::beans; using namespace ::comphelper; using namespace ::cppu; -//........................................................................ namespace dbaccess { //========================================================================== //= ODataSettings //========================================================================== -//-------------------------------------------------------------------------- void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem) { if ( m_bQuery ) @@ -136,7 +111,6 @@ void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem) registerProperty(PROPERTY_FONTTYPE, PROPERTY_ID_FONTTYPE, PropertyAttribute::BOUND,&_pItem->m_aFont.Type, ::getCppuType(&_pItem->m_aFont.Type)); } -//-------------------------------------------------------------------------- ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,sal_Bool _bQuery) :OPropertyStateContainer(_rBHelper) ,ODataSettings_Base() @@ -144,7 +118,6 @@ ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,sal_Bool _bQuery) { } -//-------------------------------------------------------------------------- ODataSettings_Base::ODataSettings_Base() :m_bApplyFilter(sal_False) ,m_aFont(::comphelper::getDefaultFont()) @@ -153,7 +126,6 @@ ODataSettings_Base::ODataSettings_Base() { } -//-------------------------------------------------------------------------- ODataSettings_Base::ODataSettings_Base(const ODataSettings_Base& _rSource) :m_sFilter( _rSource.m_sFilter ) ,m_sHavingClause( _rSource.m_sHavingClause ) @@ -169,12 +141,10 @@ ODataSettings_Base::ODataSettings_Base(const ODataSettings_Base& _rSource) { } -// ----------------------------------------------------------------------------- ODataSettings_Base::~ODataSettings_Base() { } -// ----------------------------------------------------------------------------- void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const { static ::com::sun::star::awt::FontDescriptor aFD = ::comphelper::getDefaultFont(); @@ -226,7 +196,7 @@ void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefau _rDefault <<= aFD.Weight; break; case PROPERTY_ID_FONTSLANT: - _rDefault <<= aFD.Slant; + _rDefault <<= aFD.Slant; break; case PROPERTY_ID_FONTUNDERLINE: _rDefault <<= aFD.Underline; @@ -248,7 +218,6 @@ void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefau break; } } -//........................................................................ -} // namespace dbaccess -//........................................................................ +} // namespace dbaccess +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx index 7f1e7a244..c0db66370 100644 --- a/dbaccess/source/core/api/definitioncolumn.cxx +++ b/dbaccess/source/core/api/definitioncolumn.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,6 +45,7 @@ #include <cppuhelper/typeprovider.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -66,7 +68,6 @@ using namespace dbaccess; //============================================================ IMPLEMENT_FORWARD_XINTERFACE2(OTableColumnDescriptor,OColumn,TXChild) -//------------------------------------------------------------------------------ void OTableColumnDescriptor::impl_registerProperties() { sal_Int32 nDefaultAttr = m_bActAsDescriptor ? 0 : PropertyAttribute::READONLY; @@ -89,17 +90,14 @@ void OTableColumnDescriptor::impl_registerProperties() OColumnSettings::registerProperties( *this ); } -//-------------------------------------------------------------------------- IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptor ) // ::com::sun::star::lang::XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OTableColumnDescriptor::getImplementationName( ) throw (RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumnDescriptor"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OTableColumnDescriptor")); } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); @@ -109,7 +107,6 @@ Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( ) } // comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OTableColumnDescriptor::createArrayHelper( ) const { Sequence< Property > aProps; @@ -118,26 +115,23 @@ Sequence< ::rtl::OUString > OTableColumnDescriptor::getSupportedServiceNames( ) } // cppu::OPropertySetHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OTableColumnDescriptor::getInfoHelper() { return *static_cast< ::comphelper::OPropertyArrayUsageHelper< OTableColumnDescriptor >* >(this)->getArrayHelper(); } -//------------------------------------------------------------------------------ void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) { OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue ); ::dbaccess::notifyDataSourceModified( m_xParent, sal_True ); } -// ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL OTableColumnDescriptor::getParent( ) throw (RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); return m_xParent; } -// ----------------------------------------------------------------------------- + void SAL_CALL OTableColumnDescriptor::setParent( const Reference< XInterface >& _xParent ) throw (NoSupportException, RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); @@ -148,7 +142,6 @@ void SAL_CALL OTableColumnDescriptor::setParent( const Reference< XInterface >& //============================================================ DBG_NAME(OTableColumn); -// ------------------------------------------------------------------------- OTableColumn::OTableColumn( const ::rtl::OUString& _rName ) :OTableColumnDescriptor( false /* do not act as descriptor */ ) { @@ -156,28 +149,23 @@ OTableColumn::OTableColumn( const ::rtl::OUString& _rName ) m_sName = _rName; } -// ----------------------------------------------------------------------------- OTableColumn::~OTableColumn() { DBG_DTOR(OTableColumn,NULL); } -//-------------------------------------------------------------------------- IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumn ) -//------------------------------------------------------------------------------ rtl::OUString OTableColumn::getImplementationName( ) throw (RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumn"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OTableColumn")); } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& SAL_CALL OTableColumn::getInfoHelper() { return *OTableColumn_PBase::getArrayHelper(); } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OTableColumn::createArrayHelper( ) const { return OTableColumnDescriptor::createArrayHelper(); @@ -188,7 +176,6 @@ rtl::OUString OTableColumn::getImplementationName( ) throw (RuntimeException) // ========================================================================= DBG_NAME( OQueryColumn ); -// ------------------------------------------------------------------------- OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection,const ::rtl::OUString i_sLabel ) :OTableColumnDescriptor( false /* do not act as descriptor */ ) ,m_sLabel(i_sLabel) @@ -210,7 +197,7 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement ); OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency ); OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName ); - + m_bRowVersion = sal_False; Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW ); @@ -230,7 +217,7 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME }, { PROPERTY_REALNAME, PROPERTY_ID_REALNAME } }; - for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) { if ( xPSI->hasPropertyByName( aProps[i].sName ) ) setFastPropertyValue_NoBroadcast( aProps[i].nHandle, _rxParserColumn->getPropertyValue( aProps[i].sName ) ); @@ -244,13 +231,11 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co osl_decrementInterlockedCount( &m_refCount ); } -//-------------------------------------------------------------------------- OQueryColumn::~OQueryColumn() { DBG_DTOR( OQueryColumn, NULL ); } -//-------------------------------------------------------------------------- Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const Reference< XConnection >& _rxConnection ) { OSL_PRECOND( _rxConnection.is(), "OQueryColumn::impl_determineOriginalTableColumn: illegal connection!" ); @@ -295,28 +280,23 @@ Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const return xOriginalTableColumn; } -//-------------------------------------------------------------------------- IMPLEMENT_GET_IMPLEMENTATION_ID( OQueryColumn ) -//-------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OQueryColumn::getImplementationName( ) throw(RuntimeException) { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.dbaccess.OQueryColumn" ) ); } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& SAL_CALL OQueryColumn::getInfoHelper() { return *OQueryColumn_PBase::getArrayHelper(); } -//-------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OQueryColumn::createArrayHelper() const { return OTableColumnDescriptor::createArrayHelper(); } -//-------------------------------------------------------------------------- void SAL_CALL OQueryColumn::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const { OTableColumnDescriptor::getFastPropertyValue( _rValue, _nHandle ); @@ -353,7 +333,7 @@ void SAL_CALL OQueryColumn::getFastPropertyValue( Any& _rValue, sal_Int32 _nHand //= OColumnWrapper //========================================================================== DBG_NAME(OColumnWrapper); -//-------------------------------------------------------------------------- + OColumnWrapper::OColumnWrapper( const Reference< XPropertySet > & rCol, const bool _bNameIsReadOnly ) :OColumn( _bNameIsReadOnly ) ,m_xAggregate(rCol) @@ -374,13 +354,12 @@ OColumnWrapper::OColumnWrapper( const Reference< XPropertySet > & rCol, const bo m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName; } } -// ----------------------------------------------------------------------------- + OColumnWrapper::~OColumnWrapper() { DBG_DTOR(OColumnWrapper,NULL); } -//------------------------------------------------------------------------------ ::rtl::OUString OColumnWrapper::impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const { ::rtl::OUString sPropName; @@ -390,7 +369,6 @@ OColumnWrapper::~OColumnWrapper() return sPropName; } -//------------------------------------------------------------------------------ void OColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { // derived classes are free to either use the OPropertyContainer(Helper) mechanisms for properties, @@ -406,7 +384,6 @@ void OColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons } } -//------------------------------------------------------------------------------ sal_Bool OColumnWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw (IllegalArgumentException) { @@ -427,7 +404,6 @@ sal_Bool OColumnWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & return bModified; } -//------------------------------------------------------------------------------ void OColumnWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) { if ( OColumn::isRegisteredProperty( nHandle ) ) @@ -440,7 +416,6 @@ void OColumnWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const } } -// ----------------------------------------------------------------------------- sal_Int64 SAL_CALL OColumnWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw(RuntimeException) { Reference< XUnoTunnel > xTunnel( m_xAggregate, UNO_QUERY); @@ -452,7 +427,6 @@ sal_Int64 SAL_CALL OColumnWrapper::getSomething( const Sequence< sal_Int8 >& aId //============================================================ //= OTableColumnDescriptorWrapper //============================================================ -//-------------------------------------------------------------------------- OTableColumnDescriptorWrapper::OTableColumnDescriptorWrapper( const Reference< XPropertySet >& _rCol, const bool _bPureWrap, const bool _bIsDescriptor ) :OColumnWrapper( _rCol, !_bIsDescriptor ) ,m_bPureWrap( _bPureWrap ) @@ -463,17 +437,14 @@ OTableColumnDescriptorWrapper::OTableColumnDescriptorWrapper( const Reference< X } // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptorWrapper ) // ::com::sun::star::lang::XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OTableColumnDescriptorWrapper::getImplementationName( ) throw (RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumnDescriptorWrapper"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OTableColumnDescriptorWrapper")); } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); @@ -483,7 +454,6 @@ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNa } // comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OTableColumnDescriptorWrapper::createArrayHelper( sal_Int32 nId ) const { const sal_Int32 nHaveAlways = 7; @@ -499,10 +469,7 @@ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNa if ( nId & HAS_AUTOINCREMENT_CREATION ) ++nHaveOptionally; - const sal_Int32 nPropertyCount( nHaveAlways + nHaveOptionally ); - Sequence< Property > aTableDescProperties( nPropertyCount ); - Property* pDesc = aTableDescProperties.getArray(); - sal_Int32 nPos = 0; + BEGIN_PROPERTY_SEQUENCE( nHaveAlways + nHaveOptionally ) DECL_PROP0_BOOL( ISAUTOINCREMENT ); DECL_PROP0_BOOL( ISCURRENCY ); @@ -529,12 +496,12 @@ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNa DECL_PROP0_BOOL( ISROWVERSION ); } - OSL_ENSURE( nPos == nPropertyCount, "OTableColumnDescriptorWrapper::createArrayHelper: something went wrong!" ); + END_PROPERTY_SEQUENCE() if ( !m_bIsDescriptor ) { - for ( Property* prop = aTableDescProperties.getArray(); - prop != aTableDescProperties.getArray() + aTableDescProperties.getLength(); + for ( Property* prop = aDescriptor.getArray(); + prop != aDescriptor.getArray() + aDescriptor.getLength(); ++prop ) { @@ -546,18 +513,16 @@ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNa Sequence< Property > aBaseProperties; describeProperties( aBaseProperties ); - Sequence< Property > aAllProperties( ::comphelper::concatSequences( aTableDescProperties, aBaseProperties ) ); + Sequence< Property > aAllProperties( ::comphelper::concatSequences( aDescriptor, aBaseProperties ) ); return new ::cppu::OPropertyArrayHelper( aAllProperties, sal_False ); } // cppu::OPropertySetHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OTableColumnDescriptorWrapper::getInfoHelper() { return *static_cast< OIdPropertyArrayUsageHelper< OTableColumnDescriptorWrapper >* >(this)->getArrayHelper(m_nColTypeID); } -//------------------------------------------------------------------------------ void OTableColumnDescriptorWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { if ( m_bPureWrap ) @@ -570,7 +535,6 @@ void OTableColumnDescriptorWrapper::getFastPropertyValue( Any& rValue, sal_Int32 } } -//------------------------------------------------------------------------------ sal_Bool OTableColumnDescriptorWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw (IllegalArgumentException) { sal_Bool bModified(sal_False); @@ -595,7 +559,6 @@ sal_Bool OTableColumnDescriptorWrapper::convertFastPropertyValue( Any & rConvert return bModified; } -//------------------------------------------------------------------------------ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue @@ -615,7 +578,6 @@ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast( //============================================================ //= OTableColumnWrapper //============================================================ -//-------------------------------------------------------------------------- OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefintion, const bool _bPureWrap ) :OTableColumnDescriptorWrapper( rCol, _bPureWrap, false ) @@ -635,21 +597,17 @@ OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, osl_decrementInterlockedCount( &m_refCount ); } -//-------------------------------------------------------------------------- OTableColumnWrapper::~OTableColumnWrapper() { } -//-------------------------------------------------------------------------- IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnWrapper ) -//------------------------------------------------------------------------------ rtl::OUString OTableColumnWrapper::getImplementationName( ) throw (RuntimeException) { - return rtl::OUString::createFromAscii( "com.sun.star.sdb.OTableColumnWrapper" ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OTableColumnWrapper" )); } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OTableColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); @@ -658,16 +616,14 @@ Sequence< ::rtl::OUString > OTableColumnWrapper::getSupportedServiceNames( ) th return aSNS; } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OTableColumnWrapper::getInfoHelper() { return *static_cast< OIdPropertyArrayUsageHelper< OTableColumnWrapper >* >(this)->getArrayHelper(m_nColTypeID); } // comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OTableColumnWrapper::createArrayHelper( sal_Int32 nId ) const { return OTableColumnDescriptorWrapper::createArrayHelper( nId ); } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/makefile.mk b/dbaccess/source/core/api/makefile.mk deleted file mode 100644 index 9a4dc9d8e..000000000 --- a/dbaccess/source/core/api/makefile.mk +++ /dev/null @@ -1,82 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJINC=$(PRJ)$/source -PRJNAME=dbaccess -TARGET=api - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/dba.pmk - -# --- Files ------------------------------------- -SLOFILES= \ - $(SLO)$/querydescriptor.obj \ - $(SLO)$/FilteredContainer.obj \ - $(SLO)$/TableDeco.obj \ - $(SLO)$/RowSetCacheIterator.obj \ - $(SLO)$/RowSet.obj \ - $(SLO)$/column.obj \ - $(SLO)$/RowSetBase.obj \ - $(SLO)$/CRowSetDataColumn.obj \ - $(SLO)$/CRowSetColumn.obj \ - $(SLO)$/querycomposer.obj \ - $(SLO)$/CIndexes.obj \ - $(SLO)$/BookmarkSet.obj \ - $(SLO)$/KeySet.obj \ - $(SLO)$/StaticSet.obj \ - $(SLO)$/CacheSet.obj \ - $(SLO)$/RowSetCache.obj \ - $(SLO)$/definitioncolumn.obj \ - $(SLO)$/resultcolumn.obj \ - $(SLO)$/datacolumn.obj \ - $(SLO)$/resultset.obj \ - $(SLO)$/statement.obj \ - $(SLO)$/preparedstatement.obj \ - $(SLO)$/callablestatement.obj \ - $(SLO)$/query.obj \ - $(SLO)$/querycontainer.obj \ - $(SLO)$/table.obj \ - $(SLO)$/viewcontainer.obj \ - $(SLO)$/tablecontainer.obj \ - $(SLO)$/SingleSelectQueryComposer.obj \ - $(SLO)$/HelperCollections.obj \ - $(SLO)$/datasettings.obj \ - $(SLO)$/View.obj \ - $(SLO)$/WrappedResultSet.obj \ - $(SLO)$/OptimisticSet.obj \ - $(SLO)$/PrivateRow.obj \ - $(SLO)$/columnsettings.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/dbaccess/source/core/api/preparedstatement.cxx b/dbaccess/source/core/api/preparedstatement.cxx index 8237df8de..bca0ffa9b 100644 --- a/dbaccess/source/core/api/preparedstatement.cxx +++ b/dbaccess/source/core/api/preparedstatement.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -54,7 +55,6 @@ using namespace dbaccess; DBG_NAME(OPreparedStatement) -//-------------------------------------------------------------------------- OPreparedStatement::OPreparedStatement(const Reference< XConnection > & _xConn, const Reference< XInterface > & _xStatement) :OStatementBase(_xConn, _xStatement) @@ -66,7 +66,6 @@ OPreparedStatement::OPreparedStatement(const Reference< XConnection > & _xConn, m_pColumns = new OColumns(*this, m_aMutex, xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(),::std::vector< ::rtl::OUString>(), NULL,NULL); } -//-------------------------------------------------------------------------- OPreparedStatement::~OPreparedStatement() { m_pColumns->acquire(); @@ -77,7 +76,6 @@ OPreparedStatement::~OPreparedStatement() } // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > OPreparedStatement::getTypes() throw (RuntimeException) { OTypeCollection aTypes(::getCppuType( (const Reference< XServiceInfo > *)0 ), @@ -90,7 +88,6 @@ Sequence< Type > OPreparedStatement::getTypes() throw (RuntimeException) return aTypes.getTypes(); } -//-------------------------------------------------------------------------- Sequence< sal_Int8 > OPreparedStatement::getImplementationId() throw (RuntimeException) { static OImplementationId * pId = 0; @@ -107,7 +104,6 @@ Sequence< sal_Int8 > OPreparedStatement::getImplementationId() throw (RuntimeExc } // com::sun::star::uno::XInterface -//-------------------------------------------------------------------------- Any OPreparedStatement::queryInterface( const Type & rType ) throw (RuntimeException) { Any aIface = OStatementBase::queryInterface( rType ); @@ -124,32 +120,27 @@ Any OPreparedStatement::queryInterface( const Type & rType ) throw (RuntimeExcep return aIface; } -//-------------------------------------------------------------------------- void OPreparedStatement::acquire() throw () { OStatementBase::acquire(); } -//-------------------------------------------------------------------------- void OPreparedStatement::release() throw () { OStatementBase::release(); } // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OPreparedStatement::getImplementationName( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.OPreparedStatement"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OPreparedStatement")); } -//------------------------------------------------------------------------------ sal_Bool OPreparedStatement::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OPreparedStatement::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); @@ -159,7 +150,6 @@ Sequence< ::rtl::OUString > OPreparedStatement::getSupportedServiceNames( ) thr } // OComponentHelper -//------------------------------------------------------------------------------ void OPreparedStatement::disposing() { { @@ -171,7 +161,6 @@ void OPreparedStatement::disposing() } // ::com::sun::star::sdbcx::XColumnsSupplier -//------------------------------------------------------------------------------ Reference< ::com::sun::star::container::XNameAccess > OPreparedStatement::getColumns(void) throw( RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -206,7 +195,6 @@ Reference< ::com::sun::star::container::XNameAccess > OPreparedStatement::getCol } // XResultSetMetaDataSupplier -//------------------------------------------------------------------------------ Reference< XResultSetMetaData > OPreparedStatement::getMetaData(void) throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -215,7 +203,6 @@ Reference< XResultSetMetaData > OPreparedStatement::getMetaData(void) throw( SQL } // XPreparedStatement -//------------------------------------------------------------------------------ Reference< XResultSet > OPreparedStatement::executeQuery() throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -235,7 +222,6 @@ Reference< XResultSet > OPreparedStatement::executeQuery() throw( SQLException, return xResultSet; } -//------------------------------------------------------------------------------ sal_Int32 OPreparedStatement::executeUpdate() throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -246,7 +232,6 @@ sal_Int32 OPreparedStatement::executeUpdate() throw( SQLException, RuntimeExcept return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->executeUpdate(); } -//------------------------------------------------------------------------------ sal_Bool OPreparedStatement::execute() throw( SQLException, RuntimeException ) { MutexGuard aGuard(m_aMutex); @@ -257,14 +242,12 @@ sal_Bool OPreparedStatement::execute() throw( SQLException, RuntimeException ) return Reference< XPreparedStatement >( m_xAggregateAsSet, UNO_QUERY_THROW )->execute(); } -//------------------------------------------------------------------------------ Reference< XConnection > OPreparedStatement::getConnection(void) throw( SQLException, RuntimeException ) { return Reference< XConnection > (m_xParent, UNO_QUERY); } // XParameters -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -273,7 +256,6 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s m_xAggregateAsParameters->setNull(parameterIndex, sqlType); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -282,7 +264,6 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I m_xAggregateAsParameters->setObjectNull(parameterIndex, sqlType, typeName); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -291,7 +272,6 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool m_xAggregateAsParameters->setBoolean(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -300,7 +280,6 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x m_xAggregateAsParameters->setByte(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -309,7 +288,6 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 m_xAggregateAsParameters->setShort(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -318,7 +296,6 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x m_xAggregateAsParameters->setInt(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -327,7 +304,6 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x m_xAggregateAsParameters->setLong(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -336,7 +312,6 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) m_xAggregateAsParameters->setFloat(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -345,7 +320,6 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x m_xAggregateAsParameters->setDouble(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -354,7 +328,6 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::r m_xAggregateAsParameters->setString(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -363,7 +336,6 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ m_xAggregateAsParameters->setBytes(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -372,7 +344,6 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const ::com m_xAggregateAsParameters->setDate(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -381,7 +352,6 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const ::com m_xAggregateAsParameters->setTime(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -390,7 +360,6 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const m_xAggregateAsParameters->setTimestamp(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -399,7 +368,6 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con m_xAggregateAsParameters->setBinaryStream(parameterIndex, x, length); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -408,7 +376,6 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, m_xAggregateAsParameters->setCharacterStream(parameterIndex, x, length); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -417,7 +384,6 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any m_xAggregateAsParameters->setObject(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -426,7 +392,6 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c m_xAggregateAsParameters->setObjectWithInfo(parameterIndex, x, targetSqlType, scale); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -435,7 +400,6 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere m_xAggregateAsParameters->setRef(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -444,7 +408,6 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer m_xAggregateAsParameters->setBlob(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -453,7 +416,6 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer m_xAggregateAsParameters->setClob(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -462,7 +424,6 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe m_xAggregateAsParameters->setArray(parameterIndex, x); } -//------------------------------------------------------------------------------ void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -470,4 +431,4 @@ void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, Runtim m_xAggregateAsParameters->clearParameters(); } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index bbd5f0a00..7ff064df8 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,83 +29,38 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_COREAPI_QUERY_HXX_ #include "query.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef DBTOOLS_WARNINGSCONTAINER_HXX #include <connectivity/warningscontainer.hxx> -#endif -#ifndef DBA_HELPERCOLLECTIONS_HXX #include "HelperCollections.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_ #include <cppuhelper/queryinterface.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef _COMPHELPER_PROPERTY_AGGREGATION_HXX_ +#include <osl/diagnose.h> #include <comphelper/propagg.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_ #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif /** === end UNO includes === **/ -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX #include <unotools/sharedunocomponent.hxx> -#endif -#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_ #include "definitioncolumn.hxx" -#endif #include <functional> -#ifndef DBACORE_SDBCORETOOLS_HXX #include "sdbcoretools.hxx" -#endif -#ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX #include "querycomposer.hxx" -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef DBA_CONTAINERMEDIATOR_HXX #include "ContainerMediator.hxx" -#endif using namespace dbaccess; using namespace ::com::sun::star::uno; @@ -120,16 +76,14 @@ using namespace ::osl; using namespace ::cppu; using namespace ::utl; -//........................................................................ namespace dbaccess { -//........................................................................ //========================================================================== //= OQuery //========================================================================== DBG_NAME(OQuery) -//-------------------------------------------------------------------------- + OQuery::OQuery( const Reference< XPropertySet >& _rxCommandDefinition ,const Reference< XConnection >& _rxConn ,const Reference< XMultiServiceFactory >& _xORB) @@ -148,7 +102,7 @@ OQuery::OQuery( const Reference< XPropertySet >& _rxCommandDefinition ODataSettings::registerPropertiesFor(this); osl_incrementInterlockedCount(&m_refCount); - DBG_ASSERT(m_xCommandDefinition.is(), "OQuery::OQuery : invalid CommandDefinition object !"); + OSL_ENSURE(m_xCommandDefinition.is(), "OQuery::OQuery : invalid CommandDefinition object !"); if ( m_xCommandDefinition.is() ) { try @@ -157,27 +111,26 @@ OQuery::OQuery( const Reference< XPropertySet >& _rxCommandDefinition } catch(Exception&) { - OSL_ENSURE(sal_False, "OQueryDescriptor_Base::OQueryDescriptor_Base: caught an exception!"); + OSL_FAIL("OQueryDescriptor_Base::OQueryDescriptor_Base: caught an exception!"); } m_xCommandDefinition->addPropertyChangeListener(::rtl::OUString(), this); // m_xCommandDefinition->addPropertyChangeListener(PROPERTY_NAME, this); m_xCommandPropInfo = m_xCommandDefinition->getPropertySetInfo(); } - DBG_ASSERT(m_xConnection.is(), "OQuery::OQuery : invalid connection !"); + OSL_ENSURE(m_xConnection.is(), "OQuery::OQuery : invalid connection !"); osl_decrementInterlockedCount(&m_refCount); } -//-------------------------------------------------------------------------- OQuery::~OQuery() { DBG_DTOR(OQuery, NULL); } -// ----------------------------------------------------------------------------- + IMPLEMENT_IMPLEMENTATION_ID(OQuery); IMPLEMENT_GETTYPES3(OQuery,OQueryDescriptor_Base,ODataSettings,OContentHelper); IMPLEMENT_FORWARD_XINTERFACE3( OQuery,OContentHelper,OQueryDescriptor_Base,ODataSettings) -//-------------------------------------------------------------------------- + void OQuery::rebuildColumns() { OSL_PRECOND( getColumnCount() == 0, "OQuery::rebuildColumns: column container should be empty!" ); @@ -225,7 +178,7 @@ void OQuery::rebuildColumns() } Reference< XDatabaseMetaData > xDBMeta( m_xConnection->getMetaData(), UNO_QUERY_THROW ); - ::vos::ORef< OSQLColumns > aParseColumns( + ::rtl::Reference< OSQLColumns > aParseColumns( ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, xDBMeta,xColumnDefinitions ) ); xColumns = OPrivateColumns::createWithIntrinsicNames( aParseColumns, xDBMeta->supportsMixedCaseQuotedIdentifiers(), *this, m_aMutex ); @@ -277,18 +230,16 @@ void OQuery::rebuildColumns() } // XServiceInfo -//-------------------------------------------------------------------------- IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS, SERVICE_SDB_QUERY, SERVICE_SDB_QUERYDEFINITION) // ::com::sun::star::beans::XPropertyChangeListener -//-------------------------------------------------------------------------- void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource ) throw(RuntimeException) { sal_Int32 nOwnHandle = -1; { MutexGuard aGuard(m_aMutex); - DBG_ASSERT(_rSource.Source.get() == Reference< XInterface >(m_xCommandDefinition, UNO_QUERY).get(), + OSL_ENSURE(_rSource.Source.get() == Reference< XInterface >(m_xCommandDefinition, UNO_QUERY).get(), "OQuery::propertyChange : where did this call come from ?"); if (m_eDoingCurrently == SETTING_PROPERTIES) @@ -307,20 +258,19 @@ void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource ) thro } else { - DBG_ERROR("OQuery::propertyChange : my CommandDefinition has more properties than I do !"); + OSL_FAIL("OQuery::propertyChange : my CommandDefinition has more properties than I do !"); } } fire(&nOwnHandle, &_rSource.NewValue, &_rSource.OldValue, 1, sal_False); } -//-------------------------------------------------------------------------- void SAL_CALL OQuery::disposing( const EventObject& _rSource ) throw (RuntimeException) { MutexGuard aGuard(m_aMutex); (void)_rSource; - DBG_ASSERT(_rSource.Source.get() == Reference< XInterface >(m_xCommandDefinition, UNO_QUERY).get(), + OSL_ENSURE(_rSource.Source.get() == Reference< XInterface >(m_xCommandDefinition, UNO_QUERY).get(), "OQuery::disposing : where did this call come from ?"); m_xCommandDefinition->removePropertyChangeListener(::rtl::OUString(), this); @@ -328,14 +278,12 @@ void SAL_CALL OQuery::disposing( const EventObject& _rSource ) throw (RuntimeExc } // XDataDescriptorFactory -//-------------------------------------------------------------------------- Reference< XPropertySet > SAL_CALL OQuery::createDataDescriptor( ) throw(RuntimeException) { return new OQueryDescriptor(*this); } // pseudo-XComponent -//-------------------------------------------------------------------------- void SAL_CALL OQuery::disposing() { MutexGuard aGuard(m_aMutex); @@ -349,41 +297,36 @@ void SAL_CALL OQuery::disposing() m_pWarnings = NULL; } -//-------------------------------------------------------------------------- void OQuery::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw (Exception) { ODataSettings::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); ::rtl::OUString sAggPropName; sal_Int16 nAttr = 0; - if (getInfoHelper().fillPropertyMembersByHandle(&sAggPropName,&nAttr,_nHandle) && + if (getInfoHelper().fillPropertyMembersByHandle(&sAggPropName,&nAttr,_nHandle) && m_xCommandPropInfo.is() && m_xCommandPropInfo->hasPropertyByName(sAggPropName)) { // the base class holds the property values itself, but we have to forward this to our CommandDefinition m_eDoingCurrently = SETTING_PROPERTIES; - OAutoActionReset aActionResetter(this); + OAutoActionReset aAutoReset(this); m_xCommandDefinition->setPropertyValue(sAggPropName, _rValue); if ( PROPERTY_ID_COMMAND == _nHandle ) // the columns are out of date if we are based on a new statement .... - // 90573 - 16.08.2001 - frank.schoenheit@sun.com setColumnsOutOfDate(); } } -//-------------------------------------------------------------------------- Reference< XPropertySetInfo > SAL_CALL OQuery::getPropertySetInfo( ) throw(RuntimeException) { return createPropertySetInfo( getInfoHelper() ) ; } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OQuery::getInfoHelper() { return *getArrayHelper(); } -//-------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OQuery::createArrayHelper( ) const { Sequence< Property > aProps; @@ -391,12 +334,12 @@ Reference< XPropertySetInfo > SAL_CALL OQuery::getPropertySetInfo( ) throw(Runti describeProperties(aProps); return new ::cppu::OPropertyArrayHelper(aProps); } -// ----------------------------------------------------------------------------- + OColumn* OQuery::createColumn(const ::rtl::OUString& /*_rName*/) const { return NULL; } -// ----------------------------------------------------------------------------- + void SAL_CALL OQuery::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -405,7 +348,7 @@ void SAL_CALL OQuery::rename( const ::rtl::OUString& newName ) throw (SQLExcepti if(xRename.is()) xRename->rename(newName); } -// ----------------------------------------------------------------------------- + void OQuery::registerProperties() { // the properties which OCommandBase supplies (it has no own registration, as it's not derived from @@ -432,14 +375,10 @@ void OQuery::registerProperties() &m_aLayoutInformation, ::getCppuType(&m_aLayoutInformation)); } -// ----------------------------------------------------------------------------- ::rtl::OUString OQuery::determineContentType() const { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseQuery" ) ); } -// ----------------------------------------------------------------------------- -//........................................................................ } // namespace dbaccess -//........................................................................ - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/query.hxx b/dbaccess/source/core/api/query.hxx index d04f78276..ca5eeb64e 100644 --- a/dbaccess/source/core/api/query.hxx +++ b/dbaccess/source/core/api/query.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,27 +29,13 @@ #ifndef _DBA_COREAPI_QUERY_HXX_ #define _DBA_COREAPI_QUERY_HXX_ -#ifndef _DBA_COREAPI_QUERYDESCRIPTOR_HXX_ #include "querydescriptor.hxx" -#endif -#ifndef _CPPUHELPER_IMPLBASE3_HXX_ #include <cppuhelper/implbase3.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_ #include <com/sun/star/beans/XPropertyChangeListener.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_ #include <com/sun/star/sdbcx/XRename.hpp> -#endif -#ifndef DBA_CONTENTHELPER_HXX #include "ContentHelper.hxx" -#endif #include <map> @@ -83,7 +70,7 @@ class OQuery :public OContentHelper friend struct TRelease; public: - typedef ::std::map< ::rtl::OUString,OColumn*,::comphelper::UStringMixLess> TNameColumnMap; + typedef ::std::map< ::rtl::OUString,OColumn*,::comphelper::UStringMixLess> TNameColumnMap; protected: // TNameColumnMap m_aColumnMap; // contains all columnnames to columns @@ -184,3 +171,4 @@ private: #endif // _DBA_COREAPI_QUERY_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/querycomposer.cxx b/dbaccess/source/core/api/querycomposer.cxx index fab4af44c..9bf2e3400 100644 --- a/dbaccess/source/core/api/querycomposer.cxx +++ b/dbaccess/source/core/api/querycomposer.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,76 +29,30 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_ #include <com/sun/star/util/XNumberFormatter.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNSEARCH_HPP_ #include <com/sun/star/sdbc/ColumnSearch.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ #include <com/sun/star/sdbc/XResultSetMetaData.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_ #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _COM_SUN_STAR_UNO_XAGGREGATION_HPP_ #include <com/sun/star/uno/XAggregation.hpp> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ #include <comphelper/processfactory.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _UTL_CONFIGMGR_HXX_ #include <unotools/configmgr.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _COM_SUN_STAR_I18N_XLOCALEDATA_HPP_ #include <com/sun/star/i18n/XLocaleData.hpp> -#endif -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX #include <unotools/syslocale.hxx> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include <com/sun/star/container/XChild.hpp> -#endif #include <com/sun/star/sdb/SQLFilterOperator.hpp> -#ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX #include "querycomposer.hxx" -#endif -#ifndef DBA_HELPERCOLLECTIONS_HXX #include "HelperCollections.hxx" -#endif -#ifndef DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX #include "composertools.hxx" -#endif #include <algorithm> #include <rtl/logfile.hxx> @@ -120,7 +75,7 @@ using namespace ::utl; DBG_NAME(OQueryComposer) -// ------------------------------------------------------------------------- + OQueryComposer::OQueryComposer(const Reference< XConnection>& _xConnection) : OSubComponent(m_aMutex,_xConnection) { @@ -132,26 +87,26 @@ OQueryComposer::OQueryComposer(const Reference< XConnection>& _xConnection) m_xComposer.set( xFac->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW ); m_xComposerHelper.set( xFac->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW ); } -// ------------------------------------------------------------------------- + OQueryComposer::~OQueryComposer() { DBG_DTOR(OQueryComposer,NULL); } -// ----------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::disposing" ); ::comphelper::disposeComponent(m_xComposerHelper); ::comphelper::disposeComponent(m_xComposer); } -// ------------------------------------------------------------------------- + // ::com::sun::star::lang::XTypeProvider Sequence< Type > SAL_CALL OQueryComposer::getTypes() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getTypes" ); return ::comphelper::concatSequences(OSubComponent::getTypes(),OQueryComposer_BASE::getTypes()); } -// ------------------------------------------------------------------------- + Sequence< sal_Int8 > SAL_CALL OQueryComposer::getImplementationId() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getImplementationId" ); @@ -167,7 +122,7 @@ Sequence< sal_Int8 > SAL_CALL OQueryComposer::getImplementationId() throw (Runti } return pId->getImplementationId(); } -// ------------------------------------------------------------------------- + // com::sun::star::lang::XUnoTunnel sal_Int64 SAL_CALL OQueryComposer::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { @@ -177,7 +132,7 @@ sal_Int64 SAL_CALL OQueryComposer::getSomething( const Sequence< sal_Int8 >& rId return 0; } -// ------------------------------------------------------------------------- + Any SAL_CALL OQueryComposer::queryInterface( const Type & rType ) throw(RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::queryInterface" ); @@ -186,21 +141,20 @@ Any SAL_CALL OQueryComposer::queryInterface( const Type & rType ) throw(RuntimeE aRet = OQueryComposer_BASE::queryInterface(rType); return aRet; } -// ------------------------------------------------------------------------- + // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OQueryComposer::getImplementationName( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getImplementationName" ); return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.dbaccess.OQueryComposer")); } -//------------------------------------------------------------------------------ + sal_Bool OQueryComposer::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > OQueryComposer::getSupportedServiceNames( ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getSupportedServiceNames" ); @@ -208,7 +162,7 @@ Sequence< ::rtl::OUString > OQueryComposer::getSupportedServiceNames( ) throw ( aSNS[0] = SERVICE_SDB_SQLQUERYCOMPOSER; return aSNS; } -// ------------------------------------------------------------------------- + // XSQLQueryComposer ::rtl::OUString SAL_CALL OQueryComposer::getQuery( ) throw(RuntimeException) { @@ -222,7 +176,7 @@ Sequence< ::rtl::OUString > OQueryComposer::getSupportedServiceNames( ) throw ( xProp->getPropertyValue(PROPERTY_ORIGINAL) >>= sQuery; return sQuery; } -// ------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::setQuery" ); @@ -234,7 +188,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S m_sOrgFilter = m_xComposer->getFilter(); m_sOrgOrder = m_xComposer->getOrder(); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OQueryComposer::getComposedQuery( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getComposedQuery" ); @@ -244,7 +198,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S return m_xComposer->getQuery(); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OQueryComposer::getFilter( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getFilter" ); @@ -254,7 +208,7 @@ void SAL_CALL OQueryComposer::setQuery( const ::rtl::OUString& command ) throw(S aFilterCreator = ::std::for_each(m_aFilters.begin(),m_aFilters.end(),aFilterCreator); return aFilterCreator.getComposedAndClear(); } -// ------------------------------------------------------------------------- + Sequence< Sequence< PropertyValue > > SAL_CALL OQueryComposer::getStructuredFilter( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getStructuredFilter" ); @@ -263,7 +217,7 @@ Sequence< Sequence< PropertyValue > > SAL_CALL OQueryComposer::getStructuredFilt MutexGuard aGuard(m_aMutex); return m_xComposer->getStructuredFilter(); } -// ------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OQueryComposer::getOrder( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getOrder" ); @@ -274,7 +228,7 @@ Sequence< Sequence< PropertyValue > > SAL_CALL OQueryComposer::getStructuredFilt aOrderCreator = ::std::for_each(m_aOrders.begin(),m_aOrders.end(),aOrderCreator); return aOrderCreator.getComposedAndClear(); } -// ----------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySet >& column ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::appendFilterByColumn" ); @@ -307,7 +261,7 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe setFilter( aFilterCreator.getComposedAndClear() ); } -// ------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet >& column, sal_Bool ascending ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::appendOrderByColumn" ); @@ -324,7 +278,7 @@ void SAL_CALL OQueryComposer::appendOrderByColumn( const Reference< XPropertySet setOrder(aOrderCreator.getComposedAndClear()); } -// ------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::setFilter( const ::rtl::OUString& filter ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::setFilter" ); @@ -341,7 +295,7 @@ void SAL_CALL OQueryComposer::setFilter( const ::rtl::OUString& filter ) throw(S m_xComposer->setFilter( aFilterCreator.getComposedAndClear() ); } -// ------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::setOrder( const ::rtl::OUString& order ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::setOrder" ); @@ -359,7 +313,7 @@ void SAL_CALL OQueryComposer::setOrder( const ::rtl::OUString& order ) throw(SQL m_xComposer->setOrder(aOrderCreator.getComposedAndClear()); } -// ------------------------------------------------------------------------- + // XTablesSupplier Reference< XNameAccess > SAL_CALL OQueryComposer::getTables( ) throw(RuntimeException) { @@ -369,7 +323,7 @@ Reference< XNameAccess > SAL_CALL OQueryComposer::getTables( ) throw(RuntimeExc ::osl::MutexGuard aGuard( m_aMutex ); return Reference<XTablesSupplier>(m_xComposer,UNO_QUERY)->getTables(); } -// ------------------------------------------------------------------------- + // XColumnsSupplier Reference< XNameAccess > SAL_CALL OQueryComposer::getColumns( ) throw(RuntimeException) { @@ -379,7 +333,7 @@ Reference< XNameAccess > SAL_CALL OQueryComposer::getColumns( ) throw(RuntimeEx ::osl::MutexGuard aGuard( m_aMutex ); return Reference<XColumnsSupplier>(m_xComposer,UNO_QUERY)->getColumns(); } -// ------------------------------------------------------------------------- + Reference< XIndexAccess > SAL_CALL OQueryComposer::getParameters( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OQueryComposer::getParameters" ); @@ -388,19 +342,14 @@ Reference< XIndexAccess > SAL_CALL OQueryComposer::getParameters( ) throw(Runti ::osl::MutexGuard aGuard( m_aMutex ); return Reference<XParametersSupplier>(m_xComposer,UNO_QUERY)->getParameters(); } -// ----------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::acquire() throw() { OSubComponent::acquire(); } -// ----------------------------------------------------------------------------- + void SAL_CALL OQueryComposer::release() throw() { OSubComponent::release(); } -// ----------------------------------------------------------------------------- - - - - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx index be485c1f7..fb8b1e045 100644 --- a/dbaccess/source/core/api/querycontainer.cxx +++ b/dbaccess/source/core/api/querycontainer.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,65 +29,30 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_CORE_QUERYCONTAINER_HXX_ #include "querycontainer.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBA_COREAPI_QUERY_HXX_ #include "query.hxx" -#endif -#ifndef DBACCESS_OBJECTNAMEAPPROVAL_HXX #include "objectnameapproval.hxx" -#endif -#ifndef DBA_CONTAINERLISTENER_HXX #include "ContainerListener.hxx" -#endif -#ifndef DBACCESS_VETO_HXX #include "veto.hxx" -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_ #include <com/sun/star/container/XContainer.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERAPPROVEBROADCASTER_HPP_ #include <com/sun/star/container/XContainerApproveBroadcaster.hpp> -#endif /** === end UNO includes === **/ -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef _COMPHELPER_ENUMHELPER_HXX_ +#include <osl/diagnose.h> #include <comphelper/enumhelper.hxx> -#endif -#ifndef _COMPHELPER_UNO3_HXX_ #include <comphelper/uno3.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ #include <cppuhelper/exc_hlp.hxx> -#endif using namespace dbtools; using namespace ::com::sun::star::uno; @@ -102,16 +68,14 @@ using namespace ::osl; using namespace ::comphelper; using namespace ::cppu; -//........................................................................ namespace dbaccess { -//........................................................................ //========================================================================== //= OQueryContainer //========================================================================== DBG_NAME(OQueryContainer) -//------------------------------------------------------------------------------ + OQueryContainer::OQueryContainer( const Reference< XNameContainer >& _rxCommandDefinitions , const Reference< XConnection >& _rxConn @@ -128,7 +92,7 @@ OQueryContainer::OQueryContainer( { m_pCommandsListener = new OContainerListener( *this, m_aMutex ); m_pCommandsListener->acquire(); - + Reference< XContainer > xContainer( m_xCommandDefinitions, UNO_QUERY_THROW ); xContainer->addContainerListener( m_pCommandsListener ); @@ -151,20 +115,17 @@ OQueryContainer::OQueryContainer( setElementApproval( PContainerApprove( new ObjectNameApproval( _rxConn, ObjectNameApproval::TypeQuery ) ) ); } -//------------------------------------------------------------------------------ OQueryContainer::~OQueryContainer() { DBG_DTOR(OQueryContainer, NULL); // dispose(); // maybe we're already disposed, but this should be uncritical } -// ----------------------------------------------------------------------------- + IMPLEMENT_FORWARD_XINTERFACE2( OQueryContainer,ODefinitionContainer,OQueryContainer_Base) -//------------------------------------------------------------------------------ IMPLEMENT_FORWARD_XTYPEPROVIDER2( OQueryContainer,ODefinitionContainer,OQueryContainer_Base) -//------------------------------------------------------------------------------ void OQueryContainer::disposing() { ODefinitionContainer::disposing(); @@ -190,18 +151,15 @@ void OQueryContainer::disposing() } // XServiceInfo -//------------------------------------------------------------------------------ IMPLEMENT_SERVICE_INFO2(OQueryContainer, "com.sun.star.sdb.dbaccess.OQueryContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDB_QUERIES) // XDataDescriptorFactory -//-------------------------------------------------------------------------- Reference< XPropertySet > SAL_CALL OQueryContainer::createDataDescriptor( ) throw(RuntimeException) { return new OQueryDescriptor(); } // XAppend -//------------------------------------------------------------------------------ void SAL_CALL OQueryContainer::appendByDescriptor( const Reference< XPropertySet >& _rxDesc ) throw(SQLException, ElementExistException, RuntimeException) { ResettableMutexGuard aGuard(m_aMutex); @@ -242,7 +200,6 @@ void SAL_CALL OQueryContainer::appendByDescriptor( const Reference< XPropertySet } // XDrop -//------------------------------------------------------------------------------ void SAL_CALL OQueryContainer::dropByName( const ::rtl::OUString& _rName ) throw(SQLException, NoSuchElementException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -257,7 +214,6 @@ void SAL_CALL OQueryContainer::dropByName( const ::rtl::OUString& _rName ) throw m_xCommandDefinitions->removeByName(_rName); } -//------------------------------------------------------------------------------ void SAL_CALL OQueryContainer::dropByIndex( sal_Int32 _nIndex ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -274,7 +230,7 @@ void SAL_CALL OQueryContainer::dropByIndex( sal_Int32 _nIndex ) throw(SQLExcepti dropByName(sName); } -//------------------------------------------------------------------------------ + void SAL_CALL OQueryContainer::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException) { Reference< XContent > xNewElement; @@ -286,8 +242,8 @@ void SAL_CALL OQueryContainer::elementInserted( const ::com::sun::star::containe // nothing to do, we're inserting via an "appendByDescriptor" return; - DBG_ASSERT(sElementName.getLength(), "OQueryContainer::elementInserted : invalid name !"); - DBG_ASSERT(m_aDocumentMap.find(sElementName) == m_aDocumentMap.end(), "OQueryContainer::elementInserted : oops .... we're inconsistent with our master container !"); + OSL_ENSURE(sElementName.getLength(), "OQueryContainer::elementInserted : invalid name !"); + OSL_ENSURE(m_aDocumentMap.find(sElementName) == m_aDocumentMap.end(), "OQueryContainer::elementInserted : oops .... we're inconsistent with our master container !"); if (!sElementName.getLength() || hasByName(sElementName)) return; @@ -297,21 +253,19 @@ void SAL_CALL OQueryContainer::elementInserted( const ::com::sun::star::containe insertByName(sElementName,makeAny(xNewElement)); } -//------------------------------------------------------------------------------ void SAL_CALL OQueryContainer::elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException) { ::rtl::OUString sAccessor; _rEvent.Accessor >>= sAccessor; { - DBG_ASSERT(sAccessor.getLength(), "OQueryContainer::elementRemoved : invalid name !"); - DBG_ASSERT(m_aDocumentMap.find(sAccessor) != m_aDocumentMap.end(), "OQueryContainer::elementRemoved : oops .... we're inconsistent with our master container !"); + OSL_ENSURE(sAccessor.getLength(), "OQueryContainer::elementRemoved : invalid name !"); + OSL_ENSURE(m_aDocumentMap.find(sAccessor) != m_aDocumentMap.end(), "OQueryContainer::elementRemoved : oops .... we're inconsistent with our master container !"); if ( !sAccessor.getLength() || !hasByName(sAccessor) ) return; } removeByName(sAccessor); } -//------------------------------------------------------------------------------ void SAL_CALL OQueryContainer::elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException) { Reference< XPropertySet > xReplacedElement; @@ -321,18 +275,17 @@ void SAL_CALL OQueryContainer::elementReplaced( const ::com::sun::star::containe { MutexGuard aGuard(m_aMutex); - DBG_ASSERT(sAccessor.getLength(), "OQueryContainer::elementReplaced : invalid name !"); - DBG_ASSERT(m_aDocumentMap.find(sAccessor) != m_aDocumentMap.end(), "OQueryContainer::elementReplaced : oops .... we're inconsistent with our master container !"); + OSL_ENSURE(sAccessor.getLength(), "OQueryContainer::elementReplaced : invalid name !"); + OSL_ENSURE(m_aDocumentMap.find(sAccessor) != m_aDocumentMap.end(), "OQueryContainer::elementReplaced : oops .... we're inconsistent with our master container !"); if (!sAccessor.getLength() || !hasByName(sAccessor)) return; - + xNewElement = implCreateWrapper(sAccessor); } replaceByName(sAccessor,makeAny(xNewElement)); } -//------------------------------------------------------------------------------ Reference< XVeto > SAL_CALL OQueryContainer::approveInsertElement( const ContainerEvent& Event ) throw (WrappedTargetException, RuntimeException) { ::rtl::OUString sName; @@ -351,27 +304,24 @@ Reference< XVeto > SAL_CALL OQueryContainer::approveInsertElement( const Contain return xReturn; } -//------------------------------------------------------------------------------ Reference< XVeto > SAL_CALL OQueryContainer::approveReplaceElement( const ContainerEvent& /*Event*/ ) throw (WrappedTargetException, RuntimeException) { return NULL; } -//------------------------------------------------------------------------------ Reference< XVeto > SAL_CALL OQueryContainer::approveRemoveElement( const ContainerEvent& /*Event*/ ) throw (WrappedTargetException, RuntimeException) { return NULL; } -//------------------------------------------------------------------------------ void SAL_CALL OQueryContainer::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw(::com::sun::star::uno::RuntimeException) { if (_rSource.Source.get() == Reference< XInterface >(m_xCommandDefinitions, UNO_QUERY).get()) - { // our "master container" (with the command definitions) is beeing disposed - DBG_ERROR("OQueryContainer::disposing : nobody should dispose the CommandDefinition container before disposing my connection !"); + { // our "master container" (with the command definitions) is being disposed + OSL_FAIL("OQueryContainer::disposing : nobody should dispose the CommandDefinition container before disposing my connection !"); dispose(); } - else + else { Reference< XContent > xSource(_rSource.Source, UNO_QUERY); // it's one of our documents .... @@ -389,20 +339,17 @@ void SAL_CALL OQueryContainer::disposing( const ::com::sun::star::lang::EventObj } } -// ----------------------------------------------------------------------------- ::rtl::OUString OQueryContainer::determineContentType() const { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseQueryContainer" ) ); } -// ----------------------------------------------------------------------------- Reference< XContent > OQueryContainer::implCreateWrapper(const ::rtl::OUString& _rName) { Reference< XContent > xObject(m_xCommandDefinitions->getByName(_rName),UNO_QUERY); return implCreateWrapper(xObject); } -//-------------------------------------------------------------------------- Reference< XContent > OQueryContainer::implCreateWrapper(const Reference< XContent >& _rxCommandDesc) { Reference<XNameContainer> xContainer(_rxCommandDesc,UNO_QUERY); @@ -424,12 +371,12 @@ Reference< XContent > OQueryContainer::implCreateWrapper(const Reference< XConte return xReturn; } -//-------------------------------------------------------------------------- + Reference< XContent > OQueryContainer::createObject( const ::rtl::OUString& _rName) { return implCreateWrapper(_rName); } -// ----------------------------------------------------------------------------- + sal_Bool OQueryContainer::checkExistence(const ::rtl::OUString& _rName) { sal_Bool bRet = sal_False; @@ -449,19 +396,19 @@ sal_Bool OQueryContainer::checkExistence(const ::rtl::OUString& _rName) } return bRet; } -//-------------------------------------------------------------------------- + sal_Bool SAL_CALL OQueryContainer::hasElements( ) throw (RuntimeException) { MutexGuard aGuard(m_aMutex); return m_xCommandDefinitions->hasElements(); } -// ----------------------------------------------------------------------------- + sal_Int32 SAL_CALL OQueryContainer::getCount( ) throw(RuntimeException) { MutexGuard aGuard(m_aMutex); return Reference<XIndexAccess>(m_xCommandDefinitions,UNO_QUERY)->getCount(); } -// ----------------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL OQueryContainer::getElementNames( ) throw(RuntimeException) { MutexGuard aGuard(m_aMutex); @@ -469,7 +416,5 @@ Sequence< ::rtl::OUString > SAL_CALL OQueryContainer::getElementNames( ) throw( return m_xCommandDefinitions->getElementNames(); } -//........................................................................ } // namespace dbaccess -//........................................................................ - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx index f22f406b6..1f5e69a8c 100644 --- a/dbaccess/source/core/api/querydescriptor.cxx +++ b/dbaccess/source/core/api/querydescriptor.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,33 +29,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_COREAPI_QUERYDESCRIPTOR_HXX_ #include "querydescriptor.hxx" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_ #include "definitioncolumn.hxx" -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; @@ -66,17 +49,15 @@ using namespace ::comphelper; using namespace ::osl; using namespace ::cppu; -//........................................................................ namespace dbaccess { -//........................................................................ //========================================================================== //= OQueryDescriptor //========================================================================== DBG_NAME(OQueryDescriptor) -//-------------------------------------------------------------------------- -OQueryDescriptor::OQueryDescriptor() + +OQueryDescriptor::OQueryDescriptor() :OQueryDescriptor_Base(m_aMutex,*this) ,ODataSettings(m_aBHelper,sal_True) { @@ -85,7 +66,6 @@ OQueryDescriptor::OQueryDescriptor() ODataSettings::registerPropertiesFor(this); } -//-------------------------------------------------------------------------- OQueryDescriptor::OQueryDescriptor(const OQueryDescriptor_Base& _rSource) :OQueryDescriptor_Base(_rSource,*this) ,ODataSettings(m_aBHelper,sal_True) @@ -94,15 +74,15 @@ OQueryDescriptor::OQueryDescriptor(const OQueryDescriptor_Base& _rSource) registerProperties(); ODataSettings::registerPropertiesFor(this); } -// ----------------------------------------------------------------------------- + OQueryDescriptor::~OQueryDescriptor() { DBG_DTOR(OQueryDescriptor,NULL); } -// ----------------------------------------------------------------------------- + IMPLEMENT_TYPEPROVIDER2(OQueryDescriptor,OQueryDescriptor_Base,ODataSettings); IMPLEMENT_FORWARD_XINTERFACE3( OQueryDescriptor,OWeakObject,OQueryDescriptor_Base,ODataSettings) -//-------------------------------------------------------------------------- + void OQueryDescriptor::registerProperties() { // the properties which OCommandBase supplies (it has no own registration, as it's not derived from @@ -128,19 +108,17 @@ void OQueryDescriptor::registerProperties() registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND, &m_aLayoutInformation, ::getCppuType(&m_aLayoutInformation)); } -// ----------------------------------------------------------------------------- -//-------------------------------------------------------------------------- + Reference< XPropertySetInfo > SAL_CALL OQueryDescriptor::getPropertySetInfo( ) throw(RuntimeException) { return createPropertySetInfo( getInfoHelper() ) ; } -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OQueryDescriptor::getInfoHelper() { return *getArrayHelper(); } -//-------------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper* OQueryDescriptor::createArrayHelper( ) const { Sequence< Property > aProps; @@ -148,9 +126,8 @@ Reference< XPropertySetInfo > SAL_CALL OQueryDescriptor::getPropertySetInfo( ) return new ::cppu::OPropertyArrayHelper(aProps); } -// ----------------------------------------------------------------------------- DBG_NAME(OQueryDescriptor_Base); -//-------------------------------------------------------------------------- + OQueryDescriptor_Base::OQueryDescriptor_Base(::osl::Mutex& _rMutex,::cppu::OWeakObject& _rMySelf) :m_bColumnsOutOfDate(sal_True) ,m_rMutex(_rMutex) @@ -158,7 +135,7 @@ OQueryDescriptor_Base::OQueryDescriptor_Base(::osl::Mutex& _rMutex,::cppu::OWeak DBG_CTOR(OQueryDescriptor_Base,NULL); m_pColumns = new OColumns(_rMySelf, m_rMutex, sal_True,::std::vector< ::rtl::OUString>(), this,this); } -//-------------------------------------------------------------------------- + OQueryDescriptor_Base::OQueryDescriptor_Base(const OQueryDescriptor_Base& _rSource,::cppu::OWeakObject& _rMySelf) :m_bColumnsOutOfDate(sal_True) ,m_rMutex(_rSource.m_rMutex) @@ -174,7 +151,6 @@ OQueryDescriptor_Base::OQueryDescriptor_Base(const OQueryDescriptor_Base& _rSour m_aLayoutInformation = _rSource.m_aLayoutInformation; } -//-------------------------------------------------------------------------- OQueryDescriptor_Base::~OQueryDescriptor_Base() { m_pColumns->acquire(); @@ -183,7 +159,7 @@ OQueryDescriptor_Base::~OQueryDescriptor_Base() DBG_DTOR(OQueryDescriptor_Base,NULL); } -// ----------------------------------------------------------------------------- + sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) throw(RuntimeException) { if (_rIdentifier.getLength() != 16) @@ -194,9 +170,9 @@ sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 return 0; } -//-------------------------------------------------------------------------- + IMPLEMENT_IMPLEMENTATION_ID(OQueryDescriptor_Base) -//-------------------------------------------------------------------------- + void OQueryDescriptor_Base::setColumnsOutOfDate( sal_Bool _bOutOfDate ) { m_bColumnsOutOfDate = _bOutOfDate; @@ -204,13 +180,11 @@ void OQueryDescriptor_Base::setColumnsOutOfDate( sal_Bool _bOutOfDate ) m_pColumns->setInitialized(); } -//-------------------------------------------------------------------------- void OQueryDescriptor_Base::implAppendColumn( const ::rtl::OUString& _rName, OColumn* _pColumn ) { m_pColumns->append( _rName, _pColumn ); } -//-------------------------------------------------------------------------- void OQueryDescriptor_Base::clearColumns( ) { m_pColumns->clearColumns(); @@ -218,7 +192,6 @@ void OQueryDescriptor_Base::clearColumns( ) setColumnsOutOfDate(); } -//-------------------------------------------------------------------------- Reference< XNameAccess > SAL_CALL OQueryDescriptor_Base::getColumns( ) throw (RuntimeException) { MutexGuard aGuard(m_rMutex); @@ -245,23 +218,20 @@ Reference< XNameAccess > SAL_CALL OQueryDescriptor_Base::getColumns( ) throw (Ru throw; } } - + return m_pColumns; } -//-------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OQueryDescriptor_Base::getImplementationName( ) throw(RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.sdb.OQueryDescriptor"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OQueryDescriptor")); } -//-------------------------------------------------------------------------- sal_Bool SAL_CALL OQueryDescriptor_Base::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//-------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OQueryDescriptor_Base::getSupportedServiceNames( ) throw(RuntimeException) { Sequence< ::rtl::OUString > aSupported(2); @@ -269,37 +239,32 @@ Sequence< ::rtl::OUString > SAL_CALL OQueryDescriptor_Base::getSupportedServiceN aSupported.getArray()[1] = SERVICE_SDB_QUERYDESCRIPTOR; return aSupported; } -//-------------------------------------------------------------------------- + void OQueryDescriptor_Base::disposeColumns() { m_pColumns->disposing(); } -// ----------------------------------------------------------------------------- void OQueryDescriptor_Base::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ ) { // not interested in } -// ----------------------------------------------------------------------------- void OQueryDescriptor_Base::columnDropped(const ::rtl::OUString& /*_sName*/) { // not interested in } -// ----------------------------------------------------------------------------- Reference< XPropertySet > OQueryDescriptor_Base::createColumnDescriptor() { - OSL_ENSURE( false, "OQueryDescriptor_Base::createColumnDescriptor: called why?" ); + OSL_FAIL( "OQueryDescriptor_Base::createColumnDescriptor: called why?" ); return NULL; } -// ----------------------------------------------------------------------------- void OQueryDescriptor_Base::rebuildColumns( ) { } -// ----------------------------------------------------------------------------- // IRefreshableColumns void OQueryDescriptor_Base::refreshColumns() { @@ -309,15 +274,12 @@ void OQueryDescriptor_Base::refreshColumns() rebuildColumns(); } -//------------------------------------------------------------------------------ OColumn* OQueryDescriptor_Base::createColumn( const ::rtl::OUString& /*_rName*/ ) const { // creating a column/descriptor for a query/descriptor does not make sense at all return NULL; } -// ----------------------------------------------------------------------------- -//........................................................................ -} // namespace dbaccess -//........................................................................ +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/querydescriptor.hxx b/dbaccess/source/core/api/querydescriptor.hxx index 61395e59e..58349c909 100644 --- a/dbaccess/source/core/api/querydescriptor.hxx +++ b/dbaccess/source/core/api/querydescriptor.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,44 +29,20 @@ #ifndef _DBA_COREAPI_QUERYDESCRIPTOR_HXX_ #define _DBA_COREAPI_QUERYDESCRIPTOR_HXX_ -#ifndef _CPPUHELPER_IMPLBASE3_HXX_ #include <cppuhelper/implbase3.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include <comphelper/proparrhlp.hxx> -#endif -#ifndef _OSL_MUTEX_HXX_ #include <osl/mutex.hxx> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _DBA_COREAPI_COLUMN_HXX_ #include "column.hxx" -#endif -#ifndef _DBA_CORE_DATASETTINGS_HXX_ #include "datasettings.hxx" -#endif -#ifndef _DBA_CORE_COMMANDBASE_HXX_ #include "commandbase.hxx" -#endif -#ifndef _COMPHELPER_BROADCASTHELPER_HXX_ #include <comphelper/broadcasthelper.hxx> -#endif -#ifndef _COMPHELPER_UNO3_HXX_ #include <comphelper/uno3.hxx> -#endif //........................................................................ namespace dbaccess @@ -181,3 +158,4 @@ public: #endif // _DBA_COREAPI_QUERYDESCRIPTOR_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/resultcolumn.cxx b/dbaccess/source/core/api/resultcolumn.cxx index 27532a3f2..208942e10 100644 --- a/dbaccess/source/core/api/resultcolumn.cxx +++ b/dbaccess/source/core/api/resultcolumn.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,45 +28,19 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBACORE_RESULTCOLUMN_HXX_ #include "resultcolumn.hxx" -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include <com/sun/star/sdbc/ColumnValue.hpp> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ #include <cppuhelper/exc_hlp.hxx> -#endif -#ifndef _OSL_THREAD_H_ #include <osl/thread.h> -#endif using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::beans; @@ -78,7 +53,7 @@ using namespace ::cppu; using namespace dbaccess; DBG_NAME(OResultColumn) -//-------------------------------------------------------------------------- + OResultColumn::OResultColumn( const Reference < XResultSetMetaData >& _xMetaData, sal_Int32 _nPos, const Reference< XDatabaseMetaData >& _rxDBMeta ) :OColumn( true ) @@ -88,7 +63,7 @@ OResultColumn::OResultColumn( const Reference < XResultSetMetaData >& _xMetaData { DBG_CTOR(OResultColumn,NULL); } -// ----------------------------------------------------------------------------- + void OResultColumn::impl_determineIsRowVersion_nothrow() { if ( m_aIsRowVersion.hasValue() ) @@ -98,7 +73,7 @@ void OResultColumn::impl_determineIsRowVersion_nothrow() OSL_ENSURE( m_xDBMetaData.is(), "OResultColumn::impl_determineIsRowVersion_nothrow: no DBMetaData!" ); if ( !m_xDBMetaData.is() ) return; - + try { ::rtl::OUString sCatalog, sSchema, sTable, sColumnName; @@ -133,13 +108,13 @@ void OResultColumn::impl_determineIsRowVersion_nothrow() DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + OResultColumn::~OResultColumn() { DBG_DTOR(OResultColumn,NULL); } + // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< sal_Int8 > OResultColumn::getImplementationId() throw (RuntimeException) { static OImplementationId * pId = 0; @@ -156,13 +131,11 @@ Sequence< sal_Int8 > OResultColumn::getImplementationId() throw (RuntimeExceptio } // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OResultColumn::getImplementationName( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultColumn"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OResultColumn")); } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OResultColumn::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); @@ -172,7 +145,6 @@ Sequence< ::rtl::OUString > OResultColumn::getSupportedServiceNames( ) throw (R } // OComponentHelper -//------------------------------------------------------------------------------ void OResultColumn::disposing() { OColumn::disposing(); @@ -182,7 +154,6 @@ void OResultColumn::disposing() } // comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OResultColumn::createArrayHelper( ) const { BEGIN_PROPERTY_HELPER(21) @@ -211,13 +182,11 @@ void OResultColumn::disposing() } // cppu::OPropertySetHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OResultColumn::getInfoHelper() { return *static_cast< ::comphelper::OPropertyArrayUsageHelper< OResultColumn >* >(this)->getArrayHelper(); } -//------------------------------------------------------------------------------ namespace { template< typename TYPE > @@ -229,7 +198,6 @@ namespace } } -//------------------------------------------------------------------------------ void OResultColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { try @@ -304,7 +272,7 @@ void OResultColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const rValue <<= m_xMetaData->getColumnTypeName(m_nPos); break; default: - OSL_ENSURE( false, "OResultColumn::getFastPropertyValue: unknown property handle!" ); + OSL_FAIL( "OResultColumn::getFastPropertyValue: unknown property handle!" ); break; } } @@ -354,4 +322,4 @@ void OResultColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const } } } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/resultcolumn.hxx b/dbaccess/source/core/api/resultcolumn.hxx index 76f856615..789a26f1c 100644 --- a/dbaccess/source/core/api/resultcolumn.hxx +++ b/dbaccess/source/core/api/resultcolumn.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,12 +29,8 @@ #ifndef _DBACORE_RESULTCOLUMN_HXX_ #define _DBACORE_RESULTCOLUMN_HXX_ -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HDL_ #include <com/sun/star/sdbc/XResultSetMetaData.hdl> -#endif -#ifndef _DBA_COREAPI_COLUMN_HXX_ #include <column.hxx> -#endif #include <boost/optional.hpp> namespace dbaccess { @@ -99,3 +96,4 @@ namespace dbaccess } #endif // _DBACORE_RESULTCOLUMN_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx index 05aa785e2..38051bbdb 100644 --- a/dbaccess/source/core/api/resultset.cxx +++ b/dbaccess/source/core/api/resultset.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,63 +28,28 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_COREAPI_RESULTSET_HXX_ #include <resultset.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ #include <com/sun/star/sdbc/ResultSetType.hpp> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX //autogen #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef _DBA_COREAPI_DATACOLUMN_HXX_ #include <datacolumn.hxx> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ #include <cppuhelper/exc_hlp.hxx> -#endif -#ifndef _OSL_THREAD_H_ #include <osl/thread.h> -#endif #include <rtl/logfile.hxx> using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; -//using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -95,7 +61,6 @@ using namespace dbtools; DBG_NAME(OResultSet) -//-------------------------------------------------------------------------- OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResultSet, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xStatement, sal_Bool _bCaseSensitive) @@ -139,7 +104,6 @@ OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star: } } -//-------------------------------------------------------------------------- OResultSet::~OResultSet() { m_pColumns->acquire(); @@ -150,7 +114,6 @@ OResultSet::~OResultSet() } // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > OResultSet::getTypes() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTypes" ); @@ -160,7 +123,6 @@ Sequence< Type > OResultSet::getTypes() throw (RuntimeException) return aTypes.getTypes(); } -//-------------------------------------------------------------------------- Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationId" ); @@ -178,7 +140,6 @@ Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException) } // com::sun::star::uno::XInterface -//-------------------------------------------------------------------------- Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" ); @@ -191,13 +152,11 @@ Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException) return aIface; } -//-------------------------------------------------------------------------- void OResultSet::acquire() throw () { OResultSetBase::acquire(); } -//-------------------------------------------------------------------------- void OResultSet::release() throw () { OResultSetBase::release(); @@ -205,7 +164,6 @@ void OResultSet::release() throw () // OResultSetBase -//------------------------------------------------------------------------------ void OResultSet::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::disposing" ); @@ -227,7 +185,6 @@ void OResultSet::disposing() } // XCloseable -//------------------------------------------------------------------------------ void OResultSet::close(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::close" ); @@ -239,21 +196,18 @@ void OResultSet::close(void) throw( SQLException, RuntimeException ) } // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OResultSet::getImplementationName( ) throw(RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationName" ); - return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultSet"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OResultSet")); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getSupportedServiceNames" ); @@ -264,7 +218,6 @@ Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (Runt } // com::sun::star::beans::XPropertySet -//------------------------------------------------------------------------------ Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" ); @@ -272,7 +225,6 @@ Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeExc } // comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" ); @@ -287,14 +239,12 @@ Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeExc } // cppu::OPropertySetHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OResultSet::getInfoHelper() { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" ); return *getArrayHelper(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException ) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::convertFastPropertyValue" ); @@ -304,7 +254,6 @@ sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldV return sal_True; } -//------------------------------------------------------------------------------ void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::setFastPropertyValue_NoBroadcast" ); @@ -319,11 +268,10 @@ void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue); break; default: - DBG_ERROR("unknown Property"); + OSL_FAIL("unknown Property"); } } -//------------------------------------------------------------------------------ void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFastPropertyValue" ); @@ -350,7 +298,6 @@ void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const } // XWarningsSupplier -//------------------------------------------------------------------------------ Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" ); @@ -359,7 +306,6 @@ Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException ) return m_aWarnings.getWarnings(); } -//------------------------------------------------------------------------------ void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" ); @@ -369,7 +315,6 @@ void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException ) } // ::com::sun::star::sdbc::XResultSetMetaDataSupplier -//------------------------------------------------------------------------------ Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" ); @@ -380,7 +325,6 @@ Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLExceptio } // ::com::sun::star::sdbc::XColumnLocate -//------------------------------------------------------------------------------ sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::findColumn" ); @@ -390,7 +334,6 @@ sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLExce return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY)->findColumn(columnName); } -//------------------------------------------------------------------------------ namespace { static Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement ) @@ -415,8 +358,8 @@ namespace return xDBMetaData; } } + // ::com::sun::star::sdbcx::XColumnsSupplier -//------------------------------------------------------------------------------ Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getColumns" ); @@ -488,7 +431,6 @@ Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(voi } // ::com::sun::star::sdbc::XRow -//------------------------------------------------------------------------------ sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::wasNull" ); @@ -497,7 +439,7 @@ sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException ) return m_xDelegatorRow->wasNull(); } -//------------------------------------------------------------------------------ + rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getString" ); @@ -506,7 +448,7 @@ rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, return m_xDelegatorRow->getString(columnIndex); } -//------------------------------------------------------------------------------ + sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" ); @@ -515,7 +457,7 @@ sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, Runt return m_xDelegatorRow->getBoolean(columnIndex); } -//------------------------------------------------------------------------------ + sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getByte" ); @@ -524,7 +466,7 @@ sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, Runtime return m_xDelegatorRow->getByte(columnIndex); } -//------------------------------------------------------------------------------ + sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getShort" ); @@ -533,7 +475,7 @@ sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, Runti return m_xDelegatorRow->getShort(columnIndex); } -//------------------------------------------------------------------------------ + sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInt" ); @@ -542,7 +484,7 @@ sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, Runtime return m_xDelegatorRow->getInt(columnIndex); } -//------------------------------------------------------------------------------ + sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getLong" ); @@ -551,7 +493,7 @@ sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, Runtim return m_xDelegatorRow->getLong(columnIndex); } -//------------------------------------------------------------------------------ + float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFloat" ); @@ -560,7 +502,7 @@ float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeEx return m_xDelegatorRow->getFloat(columnIndex); } -//------------------------------------------------------------------------------ + double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDouble" ); @@ -569,7 +511,7 @@ double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, Runtime return m_xDelegatorRow->getDouble(columnIndex); } -//------------------------------------------------------------------------------ + Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBytes" ); @@ -578,7 +520,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep return m_xDelegatorRow->getBytes(columnIndex); } -//------------------------------------------------------------------------------ + ::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDate" ); @@ -587,7 +529,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep return m_xDelegatorRow->getDate(columnIndex); } -//------------------------------------------------------------------------------ + ::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTime" ); @@ -596,7 +538,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep return m_xDelegatorRow->getTime(columnIndex); } -//------------------------------------------------------------------------------ + ::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" ); @@ -605,7 +547,7 @@ Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLExcep return m_xDelegatorRow->getTimestamp(columnIndex); } -//------------------------------------------------------------------------------ + Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" ); @@ -614,7 +556,7 @@ Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal return m_xDelegatorRow->getBinaryStream(columnIndex); } -//------------------------------------------------------------------------------ + Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" ); @@ -623,7 +565,7 @@ Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream( return m_xDelegatorRow->getCharacterStream(columnIndex); } -//------------------------------------------------------------------------------ + Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getObject" ); @@ -632,7 +574,7 @@ Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::st return m_xDelegatorRow->getObject(columnIndex, typeMap); } -//------------------------------------------------------------------------------ + Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRef" ); @@ -641,7 +583,7 @@ Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException return m_xDelegatorRow->getRef(columnIndex); } -//------------------------------------------------------------------------------ + Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBlob" ); @@ -650,7 +592,7 @@ Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLExcepti return m_xDelegatorRow->getBlob(columnIndex); } -//------------------------------------------------------------------------------ + Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getClob" ); @@ -659,7 +601,7 @@ Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLExcepti return m_xDelegatorRow->getClob(columnIndex); } -//------------------------------------------------------------------------------ + Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getArray" ); @@ -670,7 +612,6 @@ Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLExcep } // ::com::sun::star::sdbc::XRowUpdate -//------------------------------------------------------------------------------ void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNull" ); @@ -682,7 +623,6 @@ void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeE m_xDelegatorRowUpdate->updateNull(columnIndex); } -//------------------------------------------------------------------------------ void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" ); @@ -693,7 +633,7 @@ void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLExce m_xDelegatorRowUpdate->updateBoolean(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateByte" ); @@ -704,7 +644,7 @@ void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLExcepti m_xDelegatorRowUpdate->updateByte(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateShort" ); @@ -715,7 +655,7 @@ void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLExcep m_xDelegatorRowUpdate->updateShort(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateInt" ); @@ -726,7 +666,7 @@ void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLExcepti m_xDelegatorRowUpdate->updateInt(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateLong" ); @@ -737,7 +677,7 @@ void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLExcept m_xDelegatorRowUpdate->updateLong(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" ); @@ -748,7 +688,7 @@ void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException m_xDelegatorRowUpdate->updateFloat(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" ); @@ -759,7 +699,7 @@ void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLExcepti m_xDelegatorRowUpdate->updateDouble(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateString" ); @@ -770,7 +710,7 @@ void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) thr m_xDelegatorRowUpdate->updateString(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" ); @@ -781,7 +721,7 @@ void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& m_xDelegatorRowUpdate->updateBytes(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDate" ); @@ -792,7 +732,7 @@ void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util: m_xDelegatorRowUpdate->updateDate(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTime" ); @@ -803,7 +743,7 @@ void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util: m_xDelegatorRowUpdate->updateTime(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" ); @@ -814,7 +754,7 @@ void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star:: m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x); } -//------------------------------------------------------------------------------ + void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" ); @@ -825,7 +765,7 @@ void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::co m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length); } -//------------------------------------------------------------------------------ + void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" ); @@ -836,7 +776,7 @@ void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< : m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length); } -//------------------------------------------------------------------------------ + void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" ); @@ -848,7 +788,6 @@ void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_In m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale); } -//------------------------------------------------------------------------------ void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateObject" ); @@ -861,7 +800,6 @@ void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLExc } // ::com::sun::star::sdbc::XResultSet -//------------------------------------------------------------------------------ sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::next" ); @@ -871,7 +809,6 @@ sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->next(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" ); @@ -881,7 +818,6 @@ sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->isBeforeFirst(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" ); @@ -891,7 +827,6 @@ sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->isAfterLast(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isFirst" ); @@ -901,7 +836,6 @@ sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->isFirst(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isLast" ); @@ -911,7 +845,6 @@ sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->isLast(); } -//------------------------------------------------------------------------------ void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" ); @@ -921,7 +854,6 @@ void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSet->beforeFirst(); } -//------------------------------------------------------------------------------ void OResultSet::afterLast(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::afterLast" ); @@ -931,7 +863,6 @@ void OResultSet::afterLast(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSet->afterLast(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::first" ); @@ -941,7 +872,6 @@ sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->first(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::last" ); @@ -951,7 +881,6 @@ sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->last(); } -//------------------------------------------------------------------------------ sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRow" ); @@ -961,7 +890,6 @@ sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->getRow(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::absolute" ); @@ -971,7 +899,6 @@ sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeExcepti return m_xDelegatorResultSet->absolute(row); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::relative" ); @@ -981,7 +908,6 @@ sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeExcept return m_xDelegatorResultSet->relative(rows); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::previous" ); @@ -991,7 +917,6 @@ sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->previous(); } -//------------------------------------------------------------------------------ void OResultSet::refreshRow(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" ); @@ -1001,7 +926,6 @@ void OResultSet::refreshRow(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSet->refreshRow(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowUpdated" ); @@ -1011,7 +935,6 @@ sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->rowUpdated(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" ); @@ -1021,7 +944,6 @@ sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->rowInserted(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" ); @@ -1031,7 +953,6 @@ sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException ) return m_xDelegatorResultSet->rowDeleted(); } -//------------------------------------------------------------------------------ Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getStatement" ); @@ -1042,7 +963,6 @@ Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, Runt } // ::com::sun::star::sdbcx::XRowLocate -//------------------------------------------------------------------------------ Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBookmark" ); @@ -1054,7 +974,6 @@ Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException ) return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->getBookmark(); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToBookmark" ); @@ -1066,19 +985,17 @@ sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, Ru return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveToBookmark(bookmark); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveRelativeToBookmark" ); MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed); - + checkBookmarkable(); return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows); } -//------------------------------------------------------------------------------ sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::compareBookmarks" ); @@ -1090,7 +1007,6 @@ sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) th return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->compareBookmarks(_first, _second); } -//------------------------------------------------------------------------------ sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hasOrderedBookmarks" ); @@ -1102,7 +1018,6 @@ sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeExcep return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hasOrderedBookmarks(); } -//------------------------------------------------------------------------------ sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hashBookmark" ); @@ -1115,7 +1030,6 @@ sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, Run } // ::com::sun::star::sdbc::XResultSetUpdate -//------------------------------------------------------------------------------ void OResultSet::insertRow(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::insertRow" ); @@ -1127,7 +1041,6 @@ void OResultSet::insertRow(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSetUpdate->insertRow(); } -//------------------------------------------------------------------------------ void OResultSet::updateRow(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateRow" ); @@ -1139,7 +1052,6 @@ void OResultSet::updateRow(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSetUpdate->updateRow(); } -//------------------------------------------------------------------------------ void OResultSet::deleteRow(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" ); @@ -1151,7 +1063,6 @@ void OResultSet::deleteRow(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSetUpdate->deleteRow(); } -//------------------------------------------------------------------------------ void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" ); @@ -1163,7 +1074,6 @@ void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSetUpdate->cancelRowUpdates(); } -//------------------------------------------------------------------------------ void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" ); @@ -1175,7 +1085,6 @@ void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSetUpdate->moveToInsertRow(); } -//------------------------------------------------------------------------------ void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" ); @@ -1187,7 +1096,6 @@ void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException ) m_xDelegatorResultSetUpdate->moveToCurrentRow(); } -// ----------------------------------------------------------------------------- void OResultSet::checkReadOnly() const { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkReadOnly" ); @@ -1197,12 +1105,10 @@ void OResultSet::checkReadOnly() const throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); } -// ----------------------------------------------------------------------------- void OResultSet::checkBookmarkable() const { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkBookmarkable" ); if ( !m_bIsBookmarkable ) throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); } -// ----------------------------------------------------------------------------- - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/resultset.hxx b/dbaccess/source/core/api/resultset.hxx index f95e5c2be..9bca1b5c5 100644 --- a/dbaccess/source/core/api/resultset.hxx +++ b/dbaccess/source/core/api/resultset.hxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,68 +28,28 @@ #ifndef _DBA_COREAPI_RESULTSET_HXX_ #define _DBA_COREAPI_RESULTSET_HXX_ -#ifndef _DBA_COREAPI_COLUMN_HXX_ #include "column.hxx" -#endif -#ifndef DBTOOLS_WARNINGSCONTAINER_HXX #include <connectivity/warningscontainer.hxx> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XSTATEMENT_HPP_ #include <com/sun/star/sdbc/XStatement.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ #include <com/sun/star/sdbc/XCloseable.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ #include <com/sun/star/sdbc/XWarningsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ #include <com/sun/star/sdbc/XResultSet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ #include <com/sun/star/sdbc/XColumnLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ #include <com/sun/star/sdbcx/XRowLocate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ #include <com/sun/star/sdbc/XRowUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ #include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#endif -#ifndef _CPPUHELPER_PROPSHLP_HXX #include <cppuhelper/propshlp.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ #include <comphelper/proparrhlp.hxx> -#endif -#ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> -#endif -#ifndef _CPPUHELPER_COMPBASE11_HXX_ #include <cppuhelper/compbase11.hxx> -#endif -#ifndef _COMPHELPER_BROADCASTHELPER_HXX_ #include <comphelper/broadcasthelper.hxx> -#endif namespace dbaccess { @@ -276,3 +237,4 @@ namespace dbaccess } #endif // _DBA_COREAPI_RESULTSET_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx index 58d6962c3..e0dfc1ea8 100644 --- a/dbaccess/source/core/api/statement.cxx +++ b/dbaccess/source/core/api/statement.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,42 +28,18 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_COREAPI_STATEMENT_HXX_ #include <statement.hxx> -#endif -#ifndef _DBA_COREAPI_RESULTSET_HXX_ #include <resultset.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _TOOLS_DEBUG_HXX //autogen #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif #include <rtl/logfile.hxx> using namespace ::com::sun::star::sdb; @@ -77,7 +54,6 @@ using namespace dbtools; DBG_NAME(OStatementBase) -//-------------------------------------------------------------------------- OStatementBase::OStatementBase(const Reference< XConnection > & _xConn, const Reference< XInterface > & _xStatement) :OSubComponent(m_aMutex, _xConn) @@ -93,14 +69,12 @@ OStatementBase::OStatementBase(const Reference< XConnection > & _xConn, m_xAggregateAsCancellable = Reference< ::com::sun::star::util::XCancellable > (m_xAggregateAsSet, UNO_QUERY); } -//-------------------------------------------------------------------------- OStatementBase::~OStatementBase() { DBG_DTOR(OStatementBase, NULL); } // com::sun::star::lang::XTypeProvider -//-------------------------------------------------------------------------- Sequence< Type > OStatementBase::getTypes() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getTypes" ); @@ -121,7 +95,6 @@ Sequence< Type > OStatementBase::getTypes() throw (RuntimeException) } // com::sun::star::uno::XInterface -//-------------------------------------------------------------------------- Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::queryInterface" ); @@ -140,7 +113,7 @@ Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY); if ( ::getCppuType( (const Reference< XGeneratedResultSet > *)0 ) == rType && xGRes.is() ) aIface = ::cppu::queryInterface(rType,static_cast< XGeneratedResultSet * >( this )); - } // if ( !aIface.hasValue() ) + } if ( !aIface.hasValue() ) { Reference< XPreparedBatchExecution > xGRes(m_xAggregateAsSet, UNO_QUERY); @@ -151,19 +124,16 @@ Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException return aIface; } -//-------------------------------------------------------------------------- void OStatementBase::acquire() throw () { OSubComponent::acquire(); } -//-------------------------------------------------------------------------- void OStatementBase::release() throw () { OSubComponent::release(); } -//------------------------------------------------------------------------------ void OStatementBase::disposeResultSet() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::disposeResultSet" ); @@ -175,7 +145,6 @@ void OStatementBase::disposeResultSet() } // OComponentHelper -//------------------------------------------------------------------------------ void OStatementBase::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::disposing" ); @@ -209,7 +178,6 @@ void OStatementBase::disposing() } // XCloseable -//------------------------------------------------------------------------------ void OStatementBase::close(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::close" ); @@ -221,7 +189,6 @@ void OStatementBase::close(void) throw( SQLException, RuntimeException ) } // OPropertySetHelper -//------------------------------------------------------------------------------ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getPropertySetInfo" ); @@ -229,7 +196,6 @@ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo() throw (Runtim } // comphelper::OPropertyArrayUsageHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* OStatementBase::createArrayHelper( ) const { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::createArrayHelper" ); @@ -248,14 +214,12 @@ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo() throw (Runtim } // cppu::OPropertySetHelper -//------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OStatementBase::getInfoHelper() { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getInfoHelper" ); return *getArrayHelper(); } -//------------------------------------------------------------------------------ sal_Bool OStatementBase::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException ) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::convertFastPropertyValue" ); @@ -291,7 +255,6 @@ sal_Bool OStatementBase::convertFastPropertyValue( Any & rConvertedValue, Any & return bModified; } -//------------------------------------------------------------------------------ void OStatementBase::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::setFastPropertyValue_NoBroadcast" ); @@ -322,7 +285,6 @@ void OStatementBase::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const } } -//------------------------------------------------------------------------------ void OStatementBase::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getFastPropertyValue" ); @@ -350,7 +312,6 @@ void OStatementBase::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons } // XWarningsSupplier -//------------------------------------------------------------------------------ Any OStatementBase::getWarnings(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getWarnings" ); @@ -360,7 +321,6 @@ Any OStatementBase::getWarnings(void) throw( SQLException, RuntimeException ) return Reference< XWarningsSupplier >(m_xAggregateAsSet, UNO_QUERY)->getWarnings(); } -//------------------------------------------------------------------------------ void OStatementBase::clearWarnings(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::clearWarnings" ); @@ -371,7 +331,6 @@ void OStatementBase::clearWarnings(void) throw( SQLException, RuntimeException ) } // ::com::sun::star::util::XCancellable -//------------------------------------------------------------------------------ void OStatementBase::cancel(void) throw( RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::cancel" ); @@ -383,7 +342,6 @@ void OStatementBase::cancel(void) throw( RuntimeException ) } // XMultipleResults -//------------------------------------------------------------------------------ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getResultSet" ); @@ -398,7 +356,6 @@ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( ) throw(SQLExcep return Reference< XMultipleResults >(m_xAggregateAsSet, UNO_QUERY)->getResultSet(); } -//------------------------------------------------------------------------------ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getUpdateCount" ); @@ -413,7 +370,6 @@ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( ) throw(SQLException, Runtim return Reference< XMultipleResults >(m_xAggregateAsSet, UNO_QUERY)->getUpdateCount(); } -//------------------------------------------------------------------------------ sal_Bool SAL_CALL OStatementBase::getMoreResults( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getMoreResults" ); @@ -433,7 +389,6 @@ sal_Bool SAL_CALL OStatementBase::getMoreResults( ) throw(SQLException, Runtime } // XPreparedBatchExecution -//------------------------------------------------------------------------------ void SAL_CALL OStatementBase::addBatch( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::addBatch" ); @@ -448,7 +403,6 @@ void SAL_CALL OStatementBase::addBatch( ) throw(SQLException, RuntimeException) Reference< XPreparedBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->addBatch(); } -//------------------------------------------------------------------------------ void SAL_CALL OStatementBase::clearBatch( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::clearBatch" ); @@ -463,7 +417,6 @@ void SAL_CALL OStatementBase::clearBatch( ) throw(SQLException, RuntimeExceptio Reference< XPreparedBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->clearBatch(); } -//------------------------------------------------------------------------------ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::executeBatch" ); @@ -480,7 +433,7 @@ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( ) throw(SQLExcepti return Reference< XPreparedBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->executeBatch(); } -// ----------------------------------------------------------------------------- + Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( ) throw (SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatementBase::getGeneratedValues" ); @@ -496,7 +449,6 @@ Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( ) throw (S //************************************************************ // OStatement //************************************************************ -//------------------------------------------------------------------------------ OStatement::OStatement( const Reference< XConnection >& _xConn, const Reference< XInterface > & _xStatement ) :OStatementBase( _xConn, _xStatement ) ,m_bAttemptedComposerCreation( false ) @@ -505,26 +457,22 @@ OStatement::OStatement( const Reference< XConnection >& _xConn, const Reference< m_xAggregateStatement.set( _xStatement, UNO_QUERY_THROW ); } -//------------------------------------------------------------------------------ IMPLEMENT_FORWARD_XINTERFACE2( OStatement, OStatementBase, OStatement_IFACE ); IMPLEMENT_FORWARD_XTYPEPROVIDER2( OStatement, OStatementBase, OStatement_IFACE ); // XServiceInfo -//------------------------------------------------------------------------------ rtl::OUString OStatement::getImplementationName( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::getImplementationName" ); - return rtl::OUString::createFromAscii("com.sun.star.sdb.OStatement"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OStatement")); } -//------------------------------------------------------------------------------ sal_Bool OStatement::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::supportsService" ); return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; } -//------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OStatement::getSupportedServiceNames( ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::getSupportedServiceNames" ); @@ -534,7 +482,6 @@ Sequence< ::rtl::OUString > OStatement::getSupportedServiceNames( ) throw (Runt } // XStatement -//------------------------------------------------------------------------------ Reference< XResultSet > OStatement::executeQuery( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::executeQuery" ); @@ -562,7 +509,6 @@ Reference< XResultSet > OStatement::executeQuery( const rtl::OUString& _rSQL ) t return xResultSet; } -//------------------------------------------------------------------------------ sal_Int32 OStatement::executeUpdate( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::executeUpdate" ); @@ -575,7 +521,6 @@ sal_Int32 OStatement::executeUpdate( const rtl::OUString& _rSQL ) throw( SQLExce return m_xAggregateStatement->executeUpdate( sSQL ); } -//------------------------------------------------------------------------------ sal_Bool OStatement::execute( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" ); @@ -587,7 +532,7 @@ sal_Bool OStatement::execute( const rtl::OUString& _rSQL ) throw( SQLException, ::rtl::OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) ); return m_xAggregateStatement->execute( sSQL ); } -//------------------------------------------------------------------------------ + void OStatement::addBatch( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" ); @@ -602,7 +547,7 @@ void OStatement::addBatch( const rtl::OUString& _rSQL ) throw( SQLException, Run ::rtl::OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) ); Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->addBatch( sSQL ); } -//------------------------------------------------------------------------------ + void OStatement::clearBatch( ) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" ); @@ -615,7 +560,7 @@ void OStatement::clearBatch( ) throw( SQLException, RuntimeException ) Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->clearBatch(); } -//------------------------------------------------------------------------------ + Sequence< sal_Int32 > OStatement::executeBatch( ) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" ); @@ -628,14 +573,13 @@ Sequence< sal_Int32 > OStatement::executeBatch( ) throw( SQLException, RuntimeEx return Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->executeBatch( ); } -//------------------------------------------------------------------------------ + Reference< XConnection > OStatement::getConnection(void) throw( SQLException, RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::getConnection" ); return Reference< XConnection >( m_xParent, UNO_QUERY ); } -// ----------------------------------------------------------------------------- void SAL_CALL OStatement::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::disposing" ); @@ -644,7 +588,6 @@ void SAL_CALL OStatement::disposing() m_xAggregateStatement.clear(); } -// ----------------------------------------------------------------------------- ::rtl::OUString OStatement::impl_doEscapeProcessing_nothrow( const ::rtl::OUString& _rSQL ) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::impl_doEscapeProcessing_nothrow" ); @@ -658,7 +601,7 @@ void SAL_CALL OStatement::disposing() bool bParseable = false; try { m_xComposer->setQuery( _rSQL ); bParseable = true; } catch( const SQLException& ) { } - + if ( !bParseable ) // if we cannot parse it, silently accept this. The driver is probably able to cope with it then return _rSQL; @@ -674,7 +617,6 @@ void SAL_CALL OStatement::disposing() return _rSQL; } -// ----------------------------------------------------------------------------- bool OStatement::impl_ensureComposer_nothrow() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::impl_ensureComposer_nothrow" ); @@ -694,3 +636,5 @@ bool OStatement::impl_ensureComposer_nothrow() const return m_xComposer.is(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index ec6c8e97b..bb369a3f7 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,12 +37,12 @@ #include "CIndexes.hxx" #include <tools/debug.hxx> +#include <osl/diagnose.h> #include <cppuhelper/typeprovider.hxx> #include <comphelper/enumhelper.hxx> #include <comphelper/container.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> -//#include <comphelper/extract.hxx> #include <com/sun/star/util/XRefreshListener.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbc/XRow.hpp> @@ -76,13 +77,13 @@ typedef ::std::map <sal_Int32, OTableColumn*, std::less <sal_Int32> > OColMap; //= ODBTable //========================================================================== DBG_NAME(ODBTable) -//-------------------------------------------------------------------------- + ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables ,const Reference< XConnection >& _rxConn ,const ::rtl::OUString& _rCatalog - ,const ::rtl::OUString& _rSchema + ,const ::rtl::OUString& _rSchema ,const ::rtl::OUString& _rName - ,const ::rtl::OUString& _rType + ,const ::rtl::OUString& _rType ,const ::rtl::OUString& _rDesc ,const Reference< XNameAccess >& _xColumnDefinitions) throw(SQLException) :OTable_Base(_pTables,_rxConn,_rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers(), _rName, _rType, _rDesc, _rSchema, _rCatalog ) @@ -91,32 +92,31 @@ ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" ); DBG_CTOR(ODBTable, NULL); - DBG_ASSERT(getMetaData().is(), "ODBTable::ODBTable : invalid conn !"); - DBG_ASSERT(_rName.getLength(), "ODBTable::ODBTable : name !"); + OSL_ENSURE(getMetaData().is(), "ODBTable::ODBTable : invalid conn !"); + OSL_ENSURE(_rName.getLength(), "ODBTable::ODBTable : name !"); // TODO : think about collecting the privileges here, as we can't ensure that in getFastPropertyValue, where // we do this at the moment, the statement needed can be supplied by the connection (for example the SQL-Server // ODBC driver does not allow more than one statement per connection, and in getFastPropertyValue it's more // likely that it's already used up than it's here.) } -// ----------------------------------------------------------------------------- + ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables ,const Reference< XConnection >& _rxConn) - throw(SQLException) + throw(SQLException) :OTable_Base(_pTables,_rxConn, _rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers()) ,m_nPrivileges(-1) { DBG_CTOR(ODBTable, NULL); RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" ); } -// ------------------------------------------------------------------------- + ODBTable::~ODBTable() { DBG_DTOR(ODBTable, NULL); } -// ----------------------------------------------------------------------------- + IMPLEMENT_FORWARD_REFCOUNT(ODBTable,OTable_Base) -//-------------------------------------------------------------------------- OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumn" ); @@ -140,13 +140,13 @@ OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const return pReturn; } -// ----------------------------------------------------------------------------- + void ODBTable::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnAppended" ); // not interested in } -// ----------------------------------------------------------------------------- + void ODBTable::columnDropped(const ::rtl::OUString& _sName) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnDropped" ); @@ -156,7 +156,7 @@ void ODBTable::columnDropped(const ::rtl::OUString& _sName) xDrop->dropByName(_sName); } } -//-------------------------------------------------------------------------- + Sequence< sal_Int8 > ODBTable::getImplementationId() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getImplementationId" ); @@ -174,7 +174,6 @@ Sequence< sal_Int8 > ODBTable::getImplementationId() throw (RuntimeException) } // OComponentHelper -//------------------------------------------------------------------------------ void SAL_CALL ODBTable::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::disposing" ); @@ -185,7 +184,6 @@ void SAL_CALL ODBTable::disposing() m_pColumnMediator = NULL; } -//------------------------------------------------------------------------------ void ODBTable::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getFastPropertyValue" ); @@ -196,12 +194,12 @@ void ODBTable::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const OTable_Base::getFastPropertyValue(_rValue, _nHandle); } -// ------------------------------------------------------------------------- + void ODBTable::construct() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::construct" ); ::osl::MutexGuard aGuard(m_aMutex); - + // we don't collect the privileges here, this is potentially expensive. Instead we determine them on request. // (see getFastPropertyValue) m_nPrivileges = -1; @@ -228,10 +226,10 @@ void ODBTable::construct() registerProperty(PROPERTY_PRIVILEGES, PROPERTY_ID_PRIVILEGES, PropertyAttribute::BOUND | PropertyAttribute::READONLY, &m_nPrivileges, ::getCppuType(static_cast<sal_Int32*>(NULL))); - + registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID, &m_aTextLineColor, ::getCppuType(static_cast<sal_Int32*>(NULL))); - + registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND, &m_nFontEmphasis, ::getCppuType(&m_nFontEmphasis)); @@ -257,7 +255,7 @@ void ODBTable::construct() refreshColumns(); } -// ----------------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper* ODBTable::createArrayHelper( sal_Int32 _nId) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createArrayHelper" ); @@ -279,18 +277,18 @@ void ODBTable::construct() pIter->Attributes = PropertyAttribute::READONLY; } } - - return new ::cppu::OPropertyArrayHelper(aProps); + + return new ::cppu::OPropertyArrayHelper(aProps); } -// ----------------------------------------------------------------------------- -::cppu::IPropertyArrayHelper & SAL_CALL ODBTable::getInfoHelper() -{ + +::cppu::IPropertyArrayHelper & SAL_CALL ODBTable::getInfoHelper() +{ return *ODBTable_PROP::getArrayHelper(isNew() ? 1 : 0); } -// ------------------------------------------------------------------------- + // XServiceInfo IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE) -// ------------------------------------------------------------------------- + Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getInfoHelper" ); @@ -300,7 +298,7 @@ Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeExcepti return Any(); return OTable_Base::queryInterface( rType); } -// ------------------------------------------------------------------------- + Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getTypes" ); @@ -309,7 +307,7 @@ Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) Sequence< Type > aTypes(OTable_Base::getTypes()); ::std::vector<Type> aOwnTypes; - aOwnTypes.reserve(aTypes.getLength()); + aOwnTypes.reserve(aTypes.getLength()); const Type* pIter = aTypes.getConstArray(); const Type* pEnd = pIter + aTypes.getLength(); @@ -318,12 +316,12 @@ Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) if( (*pIter != aRenameType || getRenameService().is()) && (*pIter != aAlterType || getAlterService().is())) aOwnTypes.push_back(*pIter); } - + Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; return Sequence< Type >(pTypes, aOwnTypes.size()); } + // XRename, -//------------------------------------------------------------------------------ void SAL_CALL ODBTable::rename( const ::rtl::OUString& _rNewName ) throw(SQLException, ElementExistException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::rename" ); @@ -338,7 +336,6 @@ void SAL_CALL ODBTable::rename( const ::rtl::OUString& _rNewName ) throw(SQLExce } // XAlterTable, -//------------------------------------------------------------------------------ void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, NoSuchElementException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::alterColumnByName" ); @@ -354,7 +351,7 @@ void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const getAlterService()->alterColumnByName(xTable,_rName,_rxDescriptor); m_pColumns->refresh(); } -// ----------------------------------------------------------------------------- + sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getSomething" ); @@ -366,7 +363,7 @@ sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) thr return nRet; } -// ----------------------------------------------------------------------------- + Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getUnoTunnelImplementationId" ); @@ -382,13 +379,13 @@ Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId() } return pId->getImplementationId(); } -// ----------------------------------------------------------------------------- + Reference< XPropertySet > ODBTable::createColumnDescriptor() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumnDescriptor" ); return new OTableColumnDescriptor( true ); } -// ----------------------------------------------------------------------------- + sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumns" ); @@ -402,16 +399,16 @@ sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames) pCol->setMediator( m_pColumnMediator.get() ); return pCol; } -// ----------------------------------------------------------------------------- + sdbcx::OCollection* ODBTable::createKeys(const TStringVector& _rNames) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createKeys" ); return new connectivity::OKeysHelper(this,m_aMutex,_rNames); } -// ----------------------------------------------------------------------------- + sdbcx::OCollection* ODBTable::createIndexes(const TStringVector& _rNames) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createIndexes" ); return new OIndexes(this,m_aMutex,_rNames,NULL); } -// ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index c8a047ac1..b946c2202 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -60,12 +61,8 @@ #include "objectnameapproval.hxx" #include <tools/string.hxx> #include <rtl/logfile.hxx> -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif using namespace dbaccess; using namespace dbtools; @@ -99,9 +96,9 @@ namespace if ( aState != PropertyState_DEFAULT_VALUE ) break; } - catch(Exception) + catch(const Exception&) { - OSL_ENSURE( 0, "lcl_isPropertySetDefaulted: Exception caught!" ); + OSL_FAIL( "lcl_isPropertySetDefaulted: Exception caught!" ); } } return ( pIter == pEnd ); @@ -113,8 +110,8 @@ namespace //= OTableContainer //========================================================================== DBG_NAME(OTableContainer) -//------------------------------------------------------------------------------ -OTableContainer::OTableContainer(::cppu::OWeakObject& _rParent, + +OTableContainer::OTableContainer(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const Reference< XConnection >& _xCon, sal_Bool _bCase, @@ -126,19 +123,16 @@ OTableContainer::OTableContainer(::cppu::OWeakObject& _rParent, ,m_xTableDefinitions(_xTableDefinitions) ,m_pTableMediator( NULL ) ,m_bInDrop(sal_False) -{ +{ DBG_CTOR(OTableContainer, NULL); } -//------------------------------------------------------------------------------ OTableContainer::~OTableContainer() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::OTableContainer" ); - // dispose(); DBG_DTOR(OTableContainer, NULL); } -// ----------------------------------------------------------------------------- void OTableContainer::removeMasterContainerListener() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::removeMasterContainerListener" ); @@ -153,19 +147,15 @@ void OTableContainer::removeMasterContainerListener() } } -// ----------------------------------------------------------------------------- ::rtl::OUString OTableContainer::getTableTypeRestriction() const { // no restriction at all (other than the ones provided externally) return ::rtl::OUString(); } -// ----------------------------------------------------------------------------- // XServiceInfo -//------------------------------------------------------------------------------ IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES) -// ----------------------------------------------------------------------------- namespace { void lcl_createDefintionObject(const ::rtl::OUString& _rName @@ -192,12 +182,12 @@ void lcl_createDefintionObject(const ::rtl::OUString& _rName } Reference<XColumnsSupplier> xColumnsSupplier(_xTableDefinition,UNO_QUERY); if ( xColumnsSupplier.is() ) - _xColumnDefinitions = xColumnsSupplier->getColumns(); + _xColumnDefinitions = xColumnsSupplier->getColumns(); } } -// ------------------------------------------------------------------------- + } -// ------------------------------------------------------------------------- + connectivity::sdbcx::ObjectType OTableContainer::createObject(const ::rtl::OUString& _rName) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::createObject" ); @@ -211,7 +201,7 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const ::rtl::OUStr Reference<XPropertySet> xTableDefinition; Reference<XNameAccess> xColumnDefinitions; lcl_createDefintionObject(_rName,m_xTableDefinitions,xTableDefinition,xColumnDefinitions,sal_False); - + if ( xSup.is() ) { ODBTableDecorator* pTable = new ODBTableDecorator( m_xConnection, xSup, ::dbtools::getNumberFormats( m_xConnection ) ,xColumnDefinitions); @@ -223,8 +213,8 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const ::rtl::OUStr ::rtl::OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xMetaData, _rName, - sCatalog, - sSchema, + sCatalog, + sSchema, sTable, ::dbtools::eInDataManipulation); Any aCatalog; @@ -266,17 +256,17 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const ::rtl::OUStr if ( m_pTableMediator.is() ) m_pTableMediator->notifyElementCreated(_rName,xDest); } - + return xRet; } -// ----------------------------------------------------------------------------- + Reference< XPropertySet > OTableContainer::createDescriptor() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::createDescriptor" ); Reference< XPropertySet > xRet; - // frist we have to look if the master tables does support this - // and if then create a table object as well with the master tables + // first we have to look if the master tables support this + // and if so then create a table object as well with the master tables Reference<XColumnsSupplier > xMasterColumnsSup; Reference<XDataDescriptorFactory> xDataFactory(m_xMasterContainer,UNO_QUERY); if ( xDataFactory.is() && m_xMetaData.is() ) @@ -294,7 +284,7 @@ Reference< XPropertySet > OTableContainer::createDescriptor() } return xRet; } -// ----------------------------------------------------------------------------- + // XAppend ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { @@ -335,7 +325,7 @@ ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, cons } } } - catch(Exception&) + catch(const Exception&) { throw; } @@ -376,13 +366,13 @@ ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, cons , ::rtl::OUString(PROPERTY_ROW_HEIGHT), ::rtl::OUString(PROPERTY_TEXTCOLOR) , ::rtl::OUString(PROPERTY_TEXTLINECOLOR), ::rtl::OUString(PROPERTY_TEXTEMPHASIS) , ::rtl::OUString(PROPERTY_TEXTRELIEF) }; - Sequence< ::rtl::OUString> aNames(s_pTableProps,sizeof(s_pTableProps)/sizeof(s_pTableProps[0])); + Sequence< ::rtl::OUString> aNames(s_pTableProps,SAL_N_ELEMENTS(s_pTableProps)); if ( bModified || !lcl_isPropertySetDefaulted(aNames,xTableDefinition) ) ::dbaccess::notifyDataSourceModified(m_xTableDefinitions,sal_True); return createObject( _rForName ); } -// ------------------------------------------------------------------------- + // XDrop void OTableContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { @@ -417,9 +407,8 @@ void OTableContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElement if(!sComposedName.getLength()) ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(static_cast<OFilteredContainer*>(this))); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP "); - - // #104282# OJ + ::rtl::OUString aSql(RTL_CONSTASCII_USTRINGPARAM("DROP ")); + if ( bIsView ) // here we have a view aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW ")); else @@ -441,14 +430,14 @@ void OTableContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElement m_xTableDefinitions->removeByName(_sElementName); } } - catch(Exception&) + catch(const Exception&) { m_bInDrop = sal_False; throw; } m_bInDrop = sal_False; } -// ----------------------------------------------------------------------------- + void SAL_CALL OTableContainer::elementInserted( const ContainerEvent& Event ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::elementInserted" ); @@ -467,12 +456,12 @@ void SAL_CALL OTableContainer::elementInserted( const ContainerEvent& Event ) th } } } -// ----------------------------------------------------------------------------- + void SAL_CALL OTableContainer::elementRemoved( const ContainerEvent& /*Event*/ ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::elementRemoved" ); } -// ----------------------------------------------------------------------------- + void SAL_CALL OTableContainer::elementReplaced( const ContainerEvent& Event ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::elementReplaced" ); @@ -481,26 +470,25 @@ void SAL_CALL OTableContainer::elementReplaced( const ContainerEvent& Event ) th ::rtl::OUString sOldComposedName,sNewComposedName; Event.ReplacedElement >>= sOldComposedName; Event.Accessor >>= sNewComposedName; - + renameObject(sOldComposedName,sNewComposedName); } } -// ----------------------------------------------------------------------------- + void SAL_CALL OTableContainer::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::disposing" ); OFilteredContainer::disposing(); - // say our listeners goobye + // say goodbye to our listeners m_xTableDefinitions = NULL; m_pTableMediator = NULL; } -// ----------------------------------------------------------------------------- + void SAL_CALL OTableContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "api", "Ocke.Janssen@sun.com", "OTableContainer::disposing" ); } -// ----------------------------------------------------------------------------- void OTableContainer::addMasterContainerListener() { try @@ -513,4 +501,4 @@ void OTableContainer::addMasterContainerListener() DBG_UNHANDLED_EXCEPTION(); } } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx index 42412aa2e..3a2d9659b 100644 --- a/dbaccess/source/core/api/viewcontainer.cxx +++ b/dbaccess/source/core/api/viewcontainer.cxx @@ -1,7 +1,8 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -72,7 +73,7 @@ using namespace ::connectivity::sdbcx; //= OViewContainer //========================================================================== DBG_NAME(OViewContainer) -//------------------------------------------------------------------------------ + OViewContainer::OViewContainer(::cppu::OWeakObject& _rParent ,::osl::Mutex& _rMutex ,const Reference< XConnection >& _xCon @@ -86,17 +87,14 @@ OViewContainer::OViewContainer(::cppu::OWeakObject& _rParent DBG_CTOR(OViewContainer, NULL); } -//------------------------------------------------------------------------------ OViewContainer::~OViewContainer() { - // dispose(); DBG_DTOR(OViewContainer, NULL); } -//------------------------------------------------------------------------------ + // XServiceInfo -//------------------------------------------------------------------------------ IMPLEMENT_SERVICE_INFO2(OViewContainer, "com.sun.star.sdb.dbaccess.OViewContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES) -// ----------------------------------------------------------------------------- + ObjectType OViewContainer::createObject(const ::rtl::OUString& _rName) { ObjectType xProp; @@ -108,8 +106,8 @@ ObjectType OViewContainer::createObject(const ::rtl::OUString& _rName) ::rtl::OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xMetaData, _rName, - sCatalog, - sSchema, + sCatalog, + sSchema, sTable, ::dbtools::eInDataManipulation); return new View(m_xConnection, @@ -122,12 +120,12 @@ ObjectType OViewContainer::createObject(const ::rtl::OUString& _rName) return xProp; } -// ----------------------------------------------------------------------------- + Reference< XPropertySet > OViewContainer::createDescriptor() { Reference< XPropertySet > xRet; - // frist we have to look if the master tables does support this - // and if then create a table object as well with the master tables + // first we have to look if the master tables support this + // and if so then create a table object as well with the master tables Reference<XColumnsSupplier > xMasterColumnsSup; Reference<XDataDescriptorFactory> xDataFactory(m_xMasterContainer,UNO_QUERY); if(xDataFactory.is()) @@ -137,7 +135,7 @@ Reference< XPropertySet > OViewContainer::createDescriptor() return xRet; } -// ----------------------------------------------------------------------------- + // XAppend ObjectType OViewContainer::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { @@ -181,7 +179,7 @@ ObjectType OViewContainer::appendObject( const ::rtl::OUString& _rForName, const return createObject( _rForName ); } -// ------------------------------------------------------------------------- + // XDrop void OViewContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { @@ -207,7 +205,7 @@ void OViewContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementN if(!sComposedName.getLength()) ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(static_cast<OFilteredContainer*>(this))); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP VIEW "); + ::rtl::OUString aSql(RTL_CONSTASCII_USTRINGPARAM("DROP VIEW ")); aSql += sComposedName; Reference<XConnection> xCon = m_xConnection; OSL_ENSURE(xCon.is(),"Connection is null!"); @@ -221,7 +219,7 @@ void OViewContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementN } } } -// ----------------------------------------------------------------------------- + void SAL_CALL OViewContainer::elementInserted( const ContainerEvent& Event ) throw (RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); @@ -238,7 +236,7 @@ void SAL_CALL OViewContainer::elementInserted( const ContainerEvent& Event ) thr insertElement(sName,createObject(sName)); } } -// ----------------------------------------------------------------------------- + void SAL_CALL OViewContainer::elementRemoved( const ContainerEvent& Event ) throw (RuntimeException) { ::osl::MutexGuard aGuard(m_rMutex); @@ -258,17 +256,19 @@ void SAL_CALL OViewContainer::elementRemoved( const ContainerEvent& Event ) thro m_bInElementRemoved = false; } } -// ----------------------------------------------------------------------------- + void SAL_CALL OViewContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (RuntimeException) { } -// ----------------------------------------------------------------------------- + void SAL_CALL OViewContainer::elementReplaced( const ContainerEvent& /*Event*/ ) throw (RuntimeException) { } -// ----------------------------------------------------------------------------- + ::rtl::OUString OViewContainer::getTableTypeRestriction() const { // no restriction at all (other than the ones provided externally) return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VIEW" ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |