diff options
author | Ocke Janssen <Ocke.Janssen@sun.com> | 2009-10-29 13:49:22 +0100 |
---|---|---|
committer | Ocke Janssen <Ocke.Janssen@sun.com> | 2009-10-29 13:49:22 +0100 |
commit | 3ee76c2144ab24a04b172a4695c3a7e5abfda105 (patch) | |
tree | f5d31aca67f35af961f179c555bb8461ceac1e73 | |
parent | fbd5fd6e304ee633e92b88bba45e26a65ad6cb05 (diff) | |
parent | e7f32a0dc59f554c20eeaa7d66a2b1190e752564 (diff) |
Automated merge with file:///z:\so-cwsserv02\dba33b\DEV300\ooo
-rw-r--r-- | connectivity/source/drivers/odbcbase/OPreparedStatement.cxx | 15 | ||||
-rw-r--r-- | connectivity/source/drivers/odbcbase/OTools.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/inc/odbc/OBoundParam.hxx | 6 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 20 |
4 files changed, 31 insertions, 15 deletions
diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx index 8d72c3271b82..6e9d87e933ca 100644 --- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx @@ -321,16 +321,6 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool setInt (parameterIndex, value); } // ------------------------------------------------------------------------- -#define PREP_BIND_PARAM(_ty,_jt) \ - OTools::bindParameter(m_pConnection, \ - m_aStatementHandle, \ - parameterIndex, \ - bindBuf, \ - getLengthBuf(parameterIndex), \ - (SWORD)_jt, \ - sal_False,m_pConnection->useOldDateFormat(),_pData,(Reference <XInterface>)*this,getOwnConnection()->getTextEncoding()) - - void OPreparedStatement::setParameter(sal_Int32 parameterIndex,sal_Int32 _nType,sal_Int32 _nSize,void* _pData) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -353,6 +343,10 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex,sal_Int32 _nType, case SQL_NUMERIC: ++nRealSize; break; + case SQL_BINARY:
+ case SQL_VARBINARY:
+ nRealSize=1; //dummy buffer, binary data isn't copied
+ break; default: break; } @@ -568,6 +562,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { setParameter(parameterIndex,DataType::BINARY,x.getLength(),(void*)&x); + boundParams[parameterIndex-1].setSequence(x); // this assures that the sequence stays alive } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index 39c848f34eaf..3cadb33cf188 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -210,12 +210,9 @@ void OTools::bindData( SQLSMALLINT _nOdbcType, if(pSeq) { - // memcpy(_pData,pSeq->getConstArray(),pSeq->getLength()); - _pData = (sal_Int8*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); + _pData = (sal_Int8*)pSeq->getConstArray(); *pLen = pSeq->getLength(); } - // _pData = (sal_Int8*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); - // *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); } break; case SQL_LONGVARBINARY: diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx index c71977a94910..bc896c2361d8 100644 --- a/connectivity/source/inc/odbc/OBoundParam.hxx +++ b/connectivity/source/inc/odbc/OBoundParam.hxx @@ -119,6 +119,11 @@ namespace connectivity paramInputStreamLen = len; } + void setSequence(const ::com::sun::star::uno::Sequence< sal_Int8 >& _aSequence) + { + aSequence = _aSequence; + } + //-------------------------------------------------------------------- // getInputStream // Gets the input stream for the bound parameter @@ -191,6 +196,7 @@ namespace connectivity // data is in native format. ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> paramInputStream; + ::com::sun::star::uno::Sequence< sal_Int8 > aSequence; // When an input stream is // bound to a parameter, the // input stream is saved diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index d4dc48ede241..0dece7c6965c 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1629,6 +1629,7 @@ sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion if ( aODFVersion.getLength() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 ) { // check the consistency only for the ODF1.2 and later ( according to content.xml ) + // manifest.xml might have no version, it should be checked here and the correct version should be set try { uno::Reference< document::XStorageBasedDocument > xDoc( mxModel, uno::UNO_QUERY_THROW ); @@ -1654,7 +1655,24 @@ sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion ::rtl::OUString aStorVersion; xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= aStorVersion; - bResult = aODFVersion.equals( aStorVersion ); + + // if the storage version is set in manifest.xml, it must be the same as in content.xml + // if not, set it explicitly to be used further ( it will work even for readonly storage ) + // This workaround is not nice, but I see no other way to handle it, since there are + // ODF1.2 documents without version in manifest.xml + if ( aStorVersion.getLength() ) + bResult = aODFVersion.equals( aStorVersion ); + else + xStorProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), + uno::makeAny( aODFVersion ) ); + + if ( bResult ) + { + sal_Bool bInconsistent = sal_False; + xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsInconsistent" ) ) ) + >>= bInconsistent; + bResult = !bInconsistent; + } } } } |