summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@sun.com>2009-11-13 13:58:57 +0100
committerOcke Janssen [oj] <Ocke.Janssen@sun.com>2009-11-13 13:58:57 +0100
commitca961579a2b428114eec95537272b85f4a419e71 (patch)
treecb0db93874a5aa62279159dc689e3fab15fe654d /dbaccess
parent6ae29346a41b1c02cbeb37672291684d5f9b3e5f (diff)
parentd9f5f2dd4afc737860caf3e348583d573d3e9e48 (diff)
Automated merge with file:///z:\so-cwsserv02\dba33b\DEV300\ooo
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/RowSet.cxx51
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx10
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx13
-rw-r--r--dbaccess/source/core/api/RowSetCache.hxx1
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx25
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx2
6 files changed, 49 insertions, 53 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 1a53f504a7b6..5b71c7d8e56c 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -138,6 +138,7 @@
#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
#endif
+#include <connectivity/BlobHelper.hxx>
#ifndef _DBA_CORE_TABLECONTAINER_HXX_
#include "tablecontainer.hxx"
#endif
@@ -814,7 +815,18 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
// XRowUpdate
void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- updateValue(columnIndex,ORowSetValue());
+ ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
+
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ checkUpdateConditions(columnIndex);
+ checkUpdateIterator();
+
+ ::connectivity::ORowSetValue aOldValue(((*m_aCurrentRow)->get())[columnIndex]);
+ m_pCache->updateNull(columnIndex);
+ // we have to notify all listeners
+ ((*m_aCurrentRow)->get())[columnIndex].setNull();
+ firePropertyChange(columnIndex-1 ,aOldValue);
+ fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False);
}
// -------------------------------------------------------------------------
void SAL_CALL ORowSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
@@ -886,25 +898,23 @@ void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Referenc
checkUpdateConditions(columnIndex);
checkUpdateIterator();
- ::connectivity::ORowSetValue aOldValue;
- if(((*m_aCurrentRow)->get())[columnIndex].getTypeKind() == DataType::BLOB)
- {
- m_pCache->updateBinaryStream(columnIndex,x,length);
- aOldValue = ((*m_aCurrentRow)->get())[columnIndex];
- ((*m_aCurrentRow)->get())[columnIndex] = makeAny(x);
- }
- else
+
+ //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);
- aOldValue = ((*m_aCurrentRow)->get())[columnIndex];
- ((*m_aCurrentRow)->get())[columnIndex] = aSeq;
}
-
- firePropertyChange(columnIndex-1 ,aOldValue);
- fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False);
}
// -------------------------------------------------------------------------
void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
@@ -1481,14 +1491,19 @@ Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQ
return Reference< XRef >();
}
// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return Reference< XBlob >();
+ if ( m_pCache && isInsertRow() )
+ {
+ checkCache();
+ return new ::connectivity::BlobHelper(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
+ }
+ return ORowSetBase::getBlob(columnIndex);
}
// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
- return Reference< XClob >();
+ return Reference< XClob >(getInsertValue(columnIndex).makeAny(),UNO_QUERY);
}
// -------------------------------------------------------------------------
Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index a8894bcf5f1b..d8449094fa85 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -469,18 +469,16 @@ Reference< XRef > SAL_CALL ORowSetBase::getRef( sal_Int32 /*columnIndex*/ ) thro
return NULL;
}
// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XBlob > SAL_CALL ORowSetBase::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getBlob" );
- ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *m_pMySelf );
- return NULL;
+ return Reference< XBlob >(getValue(columnIndex).makeAny(),UNO_QUERY);
}
// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
+Reference< XClob > SAL_CALL ORowSetBase::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::getClob" );
- ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *m_pMySelf );
- return NULL;
+ return Reference< XClob >(getValue(columnIndex).makeAny(),UNO_QUERY);
}
// -------------------------------------------------------------------------
Reference< XArray > SAL_CALL ORowSetBase::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 7dba4cd17cb3..4156c32635a2 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -561,10 +561,18 @@ sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark )
// -------------------------------------------------------------------------
// XRowUpdate
// -----------------------------------------------------------------------------
-void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
+void ORowSetCache::updateNull(sal_Int32 columnIndex)
{
checkUpdateConditions(columnIndex);
+ ((*m_aInsertRow)->get())[columnIndex].setBound(sal_True);
+ ((*m_aInsertRow)->get())[columnIndex].setNull();
+ ((*m_aInsertRow)->get())[columnIndex].setModified();
+}
+// -----------------------------------------------------------------------------
+void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
+{
+ checkUpdateConditions(columnIndex);
((*m_aInsertRow)->get())[columnIndex].setBound(sal_True);
((*m_aInsertRow)->get())[columnIndex] = x;
@@ -1343,11 +1351,12 @@ void ORowSetCache::moveToInsertRow( )
// we don't unbound the bookmark column
ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin()+1;
ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
- for(;aIter != aEnd;++aIter)
+ for(sal_Int32 i = 1;aIter != aEnd;++aIter,++i)
{
aIter->setBound(sal_False);
aIter->setModified(sal_False);
aIter->setNull();
+ aIter->setTypeKind(m_xMetaData->getColumnType(i));
}
}
// -------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index 0576aa68ac02..1f5be3113f8b 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -225,6 +225,7 @@ namespace dbaccess
void updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length );
void updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x );
void updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale );
+ void updateNull(sal_Int32 columnIndex);
// ::com::sun::star::sdbc::XResultSet
sal_Bool next( );
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 9d50a0d06623..3f33bc226aa2 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -799,8 +799,6 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O
m_pImpl->getDefaultDataSourceSettings()
);
- impl_insertJavaDriverClassPath_nothrow(aDriverInfo);
-
if ( m_pImpl->isEmbeddedDatabase() )
{
sal_Int32 nCount = aDriverInfo.getLength();
@@ -1502,29 +1500,6 @@ Reference< XInterface > ODatabaseSource::getThis() const
return *const_cast< ODatabaseSource* >( this );
}
// -----------------------------------------------------------------------------
-void ODatabaseSource::impl_insertJavaDriverClassPath_nothrow(Sequence< PropertyValue >& _rDriverInfo)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::impl_insertJavaDriverClassPath_nothrow" );
- Reference< XPropertySet > xPropertySet( m_pImpl->m_xSettings, UNO_QUERY_THROW );
- ::rtl::OUString sJavaDriverClass;
- xPropertySet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"))) >>= sJavaDriverClass;
- if ( sJavaDriverClass.getLength() )
- {
- static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/JDBC/DriverClassPaths"));
- ::utl::OConfigurationTreeRoot aNamesRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
- m_pImpl->m_aContext.getLegacyServiceFactory(), s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
- if ( aNamesRoot.isValid() && aNamesRoot.hasByName( sJavaDriverClass ) )
- {
- ::utl::OConfigurationNode aRegisterObj = aNamesRoot.openNode( sJavaDriverClass );
- ::rtl::OUString sURL;
- OSL_VERIFY( aRegisterObj.getNodeValue( "Path" ) >>= sURL );
-
- ::comphelper::NamedValueCollection aDriverSettings( _rDriverInfo );
- aDriverSettings.put( "JavaDriverClassPath", sURL );
- aDriverSettings >>= _rDriverInfo;
- }
- }
-}
//........................................................................
} // namespace dbaccess
//........................................................................
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index 863dc252328a..4fa86beccfef 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -299,8 +299,6 @@ private:
void clearConnections();
- void impl_insertJavaDriverClassPath_nothrow(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDriverInfo);
-
protected:
using ::cppu::OPropertySetHelper::getFastPropertyValue;
};