From 8ad2ba7e386d4f5dc82de119e216bca37fa31763 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Fri, 4 Apr 2003 16:52:28 +0000 Subject: INTEGRATION: CWS os7 (1.59.2.2.6); FILE MERGED 2003/03/28 14:13:30 os 1.59.2.2.6.2: RESYNC: (1.59.2.2-1.60); FILE MERGED 2003/03/22 17:22:11 fs 1.59.2.2.6.1: #108018# new property BookmarkSelection in the DataAccessDescriptor service --- dbaccess/source/ui/browser/dsbrowserDnD.cxx | 39 ++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'dbaccess/source/ui/browser/dsbrowserDnD.cxx') diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx index 237f7036435d..282b6cb36c02 100644 --- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx +++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dsbrowserDnD.cxx,v $ * - * $Revision: 1.60 $ + * $Revision: 1.61 $ * - * last change: $Author: hr $ $Date: 2003-03-19 17:52:12 $ + * last change: $Author: hr $ $Date: 2003-04-04 17:52:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,6 +96,9 @@ #ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ #include #endif +#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ +#include +#endif #ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_ #include #endif @@ -236,12 +239,20 @@ namespace dbaui const Reference& _xDestTable, const Reference& _xMetaData, sal_Bool bIsAutoIncrement, - const Sequence& _aSelection) throw(SQLException, RuntimeException) + const Sequence& _aSelection, + sal_Bool _bBookmarkSelection + ) throw(SQLException, RuntimeException) { Reference< XResultSetMetaDataSupplier> xSrcMetaSup(xSrcRs,UNO_QUERY); Reference xRow(xSrcRs,UNO_QUERY); - if(!xSrcRs.is() || !xRow.is()) + Reference< XRowLocate > xRowLocate( xSrcRs, UNO_QUERY ); + sal_Bool bUseSelection = _aSelection.getLength() > 0; + + if ( !xRow.is() || ( bUseSelection && _bBookmarkSelection && !xRowLocate.is() ) ) + { + DBG_ERROR( "insertRows: bad arguments!" ); return; + } ::rtl::OUString aSql(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT INTO "))); ::rtl::OUString sComposedTableName; @@ -300,7 +311,6 @@ namespace dbaui sal_Int32 nRowCount = 0; const Any* pSelBegin = _aSelection.getConstArray(); const Any* pSelEnd = pSelBegin + _aSelection.getLength(); - sal_Bool bUseSelection = _aSelection.getLength() > 0; sal_Bool bNext = sal_True; do // loop as long as there are more rows or the selection ends { @@ -308,9 +318,16 @@ namespace dbaui { if ( pSelBegin != pSelEnd ) { - sal_Int32 nPos = 0; - *pSelBegin >>= nPos; - bNext = xSrcRs->absolute( nPos ); + if ( _bBookmarkSelection ) + { + xRowLocate->moveToBookmark( *pSelBegin ); + } + else + { + sal_Int32 nPos = 0; + *pSelBegin >>= nPos; + bNext = xSrcRs->absolute( nPos ); + } ++pSelBegin; } else @@ -685,6 +702,7 @@ namespace dbaui Reference xSrcConnection; Reference xSrcRs; // the source resultset may be empty Sequence< Any > aSelection; + sal_Bool bBookmarkSelection; ::rtl::OUString sCommand,sSrcDataSourceName; _rPasteData[daDataSource] >>= sSrcDataSourceName; _rPasteData[daCommand] >>= sCommand; @@ -692,6 +710,8 @@ namespace dbaui _rPasteData[daConnection] >>= xSrcConnection; if ( _rPasteData.has(daSelection) ) _rPasteData[daSelection] >>= aSelection; + if ( _rPasteData.has(daBookmarkSelection) ) + _rPasteData[daBookmarkSelection] >>= bBookmarkSelection; if ( _rPasteData.has(daCursor) ) _rPasteData[daCursor] >>= xSrcRs; @@ -832,7 +852,8 @@ namespace dbaui xTable, xDestConnection->getMetaData(), aWizard.isAutoincrementEnabled(), - aSelection); + aSelection, + bBookmarkSelection); } break; case OCopyTableWizard::WIZARD_DEF_VIEW: -- cgit v1.2.3