summaryrefslogtreecommitdiff
path: root/dbaccess/source/core/misc
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core/misc')
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx10
-rw-r--r--dbaccess/source/core/misc/dbastrings.cxx5
-rw-r--r--dbaccess/source/core/misc/sdbcoretools.cxx76
3 files changed, 54 insertions, 37 deletions
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index 631993f7343a..c45f9f98b8a0 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -34,6 +34,7 @@
#include <connectivity/FValue.hxx>
#include <connectivity/dbtools.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/sdb/XCompletedExecution.hpp>
@@ -630,7 +631,14 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
for (sal_Int32 j = _bHasCategories ? 2 : 1,i = 0; j <= nCount; ++j,++i)
{
aValue.fill(j,aColumnTypes[j-1],xRow);
- aRow.push_back(aValue.getDouble());
+ if ( aValue.isNull() )
+ {
+ double nValue;
+ ::rtl::math::setNan( &nValue );
+ aRow.push_back(nValue);
+ }
+ else
+ aRow.push_back(aValue.getDouble());
} // for (sal_Int32 j = 2,i = 0; j <= nCount; ++j,++i)
aDataValues.push_back(aRow);
} // while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) )
diff --git a/dbaccess/source/core/misc/dbastrings.cxx b/dbaccess/source/core/misc/dbastrings.cxx
index 55424aea0e57..80f1427842e8 100644
--- a/dbaccess/source/core/misc/dbastrings.cxx
+++ b/dbaccess/source/core/misc/dbastrings.cxx
@@ -43,6 +43,7 @@ namespace dbaccess
//============================================================
//= Properties
//============================================================
- IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFORMDESIGNMODE, "ApplyFormDesignMode");
-
+ IMPLEMENT_CONSTASCII_USTRING( PROPERTY_APPLYFORMDESIGNMODE, "ApplyFormDesignMode" );
+ IMPLEMENT_CONSTASCII_USTRING( PROPERTY_IS_FORM, "IsForm" );
+ IMPLEMENT_CONSTASCII_USTRING( PROPERTY_PERSISTENT_PATH, "PersistentPath" );
}
diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx
index 907a36a13f83..dea2328dc907 100644
--- a/dbaccess/source/core/misc/sdbcoretools.cxx
+++ b/dbaccess/source/core/misc/sdbcoretools.cxx
@@ -38,6 +38,8 @@
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/task/XInteractionRequestStringResolver.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
/** === end UNO includes === **/
#include <tools/diagnose_ex.h>
@@ -55,10 +57,12 @@ namespace dbaccess
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::task;
+ using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::container;
// =========================================================================
@@ -88,39 +92,6 @@ namespace dbaccess
return xReturn;
}
- // -------------------------------------------------------------------------
- bool getDataSourceSetting( const Reference< XInterface >& _rxDataSource, const sal_Char* _pAsciiSettingsName,
- Any& /* [out] */ _rSettingsValue )
- {
- bool bIsPresent = false;
- try
- {
- Reference< XPropertySet > xDataSource( _rxDataSource, UNO_QUERY );
- OSL_ENSURE( xDataSource.is(), "getDataSourceSetting: invalid data source object!" );
- if ( !xDataSource.is() )
- return false;
-
- Sequence< PropertyValue > aSettings;
- OSL_VERIFY( xDataSource->getPropertyValue( PROPERTY_INFO ) >>= aSettings );
- const PropertyValue* pSetting = aSettings.getConstArray();
- const PropertyValue* pSettingEnd = aSettings.getConstArray() + aSettings.getLength();
- for ( ; pSetting != pSettingEnd; ++pSetting )
- {
- if ( pSetting->Name.equalsAscii( _pAsciiSettingsName ) )
- {
- _rSettingsValue = pSetting->Value;
- bIsPresent = true;
- break;
- }
- }
- }
- catch( const Exception& )
- {
- OSL_ENSURE( sal_False, "getDataSourceSetting: caught an exception!" );
- }
- return bIsPresent;
- }
-
// -----------------------------------------------------------------------------
::rtl::OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext, const Any& _rError )
{
@@ -160,7 +131,44 @@ namespace dbaccess
return sDisplayMessage;
}
-// -----------------------------------------------------------------------------
+ namespace tools { namespace stor {
+
+ // -----------------------------------------------------------------------------
+ bool storageIsWritable_nothrow( const Reference< XStorage >& _rxStorage )
+ {
+ if ( !_rxStorage.is() )
+ return false;
+
+ sal_Int32 nMode = ElementModes::READ;
+ try
+ {
+ Reference< XPropertySet > xStorageProps( _rxStorage, UNO_QUERY_THROW );
+ xStorageProps->getPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ) ) ) >>= nMode;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return ( nMode & ElementModes::WRITE ) != 0;
+ }
+
+ // -----------------------------------------------------------------------------
+ bool commitStorageIfWriteable( const Reference< XStorage >& _rxStorage ) SAL_THROW(( IOException, WrappedTargetException, RuntimeException ))
+ {
+ bool bSuccess = false;
+ Reference< XTransactedObject > xTrans( _rxStorage, UNO_QUERY );
+ if ( xTrans.is() )
+ {
+ if ( storageIsWritable_nothrow( _rxStorage ) )
+ xTrans->commit();
+ bSuccess = true;
+ }
+ return bSuccess;
+ }
+
+ } } // tools::stor
+
//.........................................................................
} // namespace dbaccess
//.........................................................................