summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/browser
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-04-04 16:52:28 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-04-04 16:52:28 +0000
commit8ad2ba7e386d4f5dc82de119e216bca37fa31763 (patch)
treeba3e71527712f64edce67852f4fb4ba80a40eb7c /dbaccess/source/ui/browser
parent937270ba019511a2a47a1fb6b10f526bd13b0104 (diff)
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
Diffstat (limited to 'dbaccess/source/ui/browser')
-rw-r--r--dbaccess/source/ui/browser/dsbrowserDnD.cxx39
1 files changed, 30 insertions, 9 deletions
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 <com/sun/star/sdbc/XColumnLocate.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#endif
#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_
#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
#endif
@@ -236,12 +239,20 @@ namespace dbaui
const Reference<XPropertySet>& _xDestTable,
const Reference<XDatabaseMetaData>& _xMetaData,
sal_Bool bIsAutoIncrement,
- const Sequence<Any>& _aSelection) throw(SQLException, RuntimeException)
+ const Sequence<Any>& _aSelection,
+ sal_Bool _bBookmarkSelection
+ ) throw(SQLException, RuntimeException)
{
Reference< XResultSetMetaDataSupplier> xSrcMetaSup(xSrcRs,UNO_QUERY);
Reference<XRow> 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<XConnection> xSrcConnection;
Reference<XResultSet> 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: