Tag: cws_src680_dba24d User: oj Date: 2007-11-27 07:32:33+0000 Modified: dba/connectivity/source/drivers/hsqldb/HStorageMap.cxx dba/connectivity/source/drivers/hsqldb/HConnection.cxx
Log: #i51355# check if stream exists when read-only File Changes: Directory: /dba/connectivity/source/drivers/hsqldb/ =================================================== File [changed]: HStorageMap.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HStorageMap.cxx?r1=1.11&r2=1.11.152.1 Delta lines: +18 -6 -------------------- --- HStorageMap.cxx 2006-09-17 02:40:55+0000 1.11 +++ HStorageMap.cxx 2007-11-27 07:32:30+0000 1.11.152.1 @@ -4,9 +4,9 @@ * * $RCSfile: HStorageMap.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.11.152.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 02:40:55 $ + * last change: $Author: oj $ $Date: 2007/11/27 07:32:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -300,14 +300,26 @@ { try { -/* if ( _nMode == ElementModes::READ ) - _nMode |= ElementModes::SEEKABLE; -*/ pHelper.reset(new StreamHelper(aStoragePair.first.first->openStreamElement(sName,_nMode))); } catch(Exception& ) { ::rtl::OUString sStrippedName = removeOldURLPrefix(sOrgName); + + if ( ((_nMode & ElementModes::WRITE) != ElementModes::WRITE ) ) + { + sal_Bool bIsStream = sal_True; + try + { + bIsStream = aStoragePair.first.first->isStreamElement(sStrippedName); + } + catch(Exception& ) + { + bIsStream = sal_False; + } + if ( !bIsStream ) + return pHelper; // readonly file without data stream + } pHelper.reset( new StreamHelper(aStoragePair.first.first->openStreamElement( sStrippedName, _nMode ) ) ); } aFind->second.second.insert(TStreamMap::value_type(sName,pHelper)); File [changed]: HConnection.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HConnection.cxx?r1=1.8&r2=1.8.142.1 Delta lines: +25 -15 --------------------- --- HConnection.cxx 2006-10-05 13:39:47+0000 1.8 +++ HConnection.cxx 2007-11-27 07:32:30+0000 1.8.142.1 @@ -4,9 +4,9 @@ * * $RCSfile: HConnection.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.8.142.1 $ * - * last change: $Author: kz $ $Date: 2006/10/05 13:39:47 $ + * last change: $Author: oj $ $Date: 2007/11/27 07:32:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -68,6 +68,7 @@ #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ #include <com/sun/star/beans/PropertyValue.hpp> #endif +#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp> /** === end UNO includes === **/ #ifndef _CONNECTIVITY_DBTOOLS_HXX_ @@ -124,6 +125,7 @@ using ::com::sun::star::uno::makeAny; using ::com::sun::star::sdbc::XResultSet; using ::com::sun::star::sdbc::XDatabaseMetaData; +using ::com::sun::star::sdbc::XDatabaseMetaData2; using ::com::sun::star::sdbc::XRow; using ::com::sun::star::sdb::application::XDatabaseDocumentUI; using ::com::sun::star::beans::PropertyValue; @@ -172,6 +174,8 @@ ,m_aFlushListeners( m_aMutex ) ,m_xDriver( _rxDriver ) ,m_xORB( _xORB ) + ,m_bIni(true) + ,m_bReadOnly(false) { setDelegation(_xConnection,_xORB,m_refCount); } @@ -211,19 +215,25 @@ { if ( m_xConnection.is() ) { -// Reference< XStatement> xStmt( m_xConnection->createStatement(), UNO_QUERY_THROW ); -// xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SET WRITE_DELAY 0" ) ) ); -// -// sal_Bool bPreviousAutoCommit = m_xConnection->getAutoCommit(); -// m_xConnection->setAutoCommit( sal_False ); -// m_xConnection->commit(); -// m_xConnection->setAutoCommit( bPreviousAutoCommit ); -// -// if ( xStmt.is() ) -// xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SET WRITE_DELAY 60" ) ) ); + if ( m_bIni ) + { + m_bIni = false; + Reference< XDatabaseMetaData2 > xMeta2(m_xConnection->getMetaData(),UNO_QUERY_THROW); + const Sequence< PropertyValue > aInfo = xMeta2->getConnectionInfo(); + const PropertyValue* pIter = aInfo.getConstArray(); + const PropertyValue* pEnd = pIter + aInfo.getLength(); + for(;pIter != pEnd;++pIter) + { + if ( pIter->Name.compareToAscii("readonly") == 0 ) + m_bReadOnly = true; + } + } + if ( !m_bReadOnly ) + { Reference< XStatement > xStmt( m_xConnection->createStatement(), UNO_QUERY_THROW ); xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CHECKPOINT" ) ) ); } + } EventObject aFlushedEvent( *this ); m_aFlushListeners.notifyEach( &XFlushListener::flushed, aFlushedEvent ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
