dbaccess/source/ui/inc/DExport.hxx         |    3 +++
 dbaccess/source/ui/uno/copytablewizard.cxx |    8 ++++++++
 2 files changed, 11 insertions(+)

New commits:
commit 2ddd1a5ca306ed6bfdcd375af094cdbd9e6212ca
Author:     Tamas Bunth <tamas.bu...@collabora.co.uk>
AuthorDate: Fri Aug 30 14:57:31 2019 +0200
Commit:     Xisco Faulí <xiscofa...@libreoffice.org>
CommitDate: Mon Sep 2 15:19:12 2019 +0200

    tdf#127093, tdf#127092 Fix pasting autoincremented
    
    Fix copy/paste functionality when trying to paste a table with auto
    incremental column in it. In that case we should let the DBMS handle the
    values in that column.
    
    Change-Id: Ia40a0056402ec540f469b94694629dd6db7d4e71
    Reviewed-on: https://gerrit.libreoffice.org/78298
    Tested-by: Jenkins
    Reviewed-by: Tamás Bunth <btom...@gmail.com>
    (cherry picked from commit fa177231cd20bf3c3f4bb9b50f6646da139c6766)
    Reviewed-on: https://gerrit.libreoffice.org/78388
    Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org>

diff --git a/dbaccess/source/ui/inc/DExport.hxx 
b/dbaccess/source/ui/inc/DExport.hxx
index 397b527d6d7d..7dbcbf31fc6a 100644
--- a/dbaccess/source/ui/inc/DExport.hxx
+++ b/dbaccess/source/ui/inc/DExport.hxx
@@ -61,6 +61,9 @@ namespace dbaui
     public:
         typedef std::map<OUString, OFieldDescription*, 
::comphelper::UStringMixLess> TColumns;
         typedef std::vector<TColumns::const_iterator>             
TColumnVector;
+
+        // first value is the position in the destination table. The second
+        // value is the position of the column in the source table.
         typedef std::vector< std::pair<sal_Int32,sal_Int32> >   TPositions;
 
     protected:
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx 
b/dbaccess/source/ui/uno/copytablewizard.cxx
index 295575187044..8d9bc43a4193 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1185,6 +1185,14 @@ void CopyTableWizard::impl_copyRows_throw( const 
Reference< XResultSet >& _rxSou
                     // otherwise we don't get the correct value when only the 
2nd source column was selected
                     continue;
                 }
+                else if( xMeta->isAutoIncrement( rColumnPos.second ) )
+                {
+                    // it is auto incremented. Let the DBMS deal with it.
+                    // TODO initial value could be set when defining the
+                    // table
+                    ++nSourceColumn;
+                    continue;
+                }
 
                 if ( bAutoIncrement && bInsertAutoIncrement )
                 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to