dbaccess/source/ui/inc/DExport.hxx | 3 +++ dbaccess/source/ui/uno/copytablewizard.cxx | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-)
New commits: commit 376cc3ea0fc2e0f209763a2a27c5852136332c86 Author: Tamas Bunth <tamas.bu...@collabora.co.uk> AuthorDate: Sat Aug 31 18:27:44 2019 +0200 Commit: Tamás Bunth <btom...@gmail.com> CommitDate: Sat Aug 31 19:43:36 2019 +0200 dbaccess: delete old paste autoincrement logic Change-Id: I6a4392c9e93842838022370fe6c54908adcc627b Reviewed-on: https://gerrit.libreoffice.org/78358 Tested-by: Jenkins Reviewed-by: Tamás Bunth <btom...@gmail.com> diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 5f25b06ef784..6abaa55f9d54 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1096,7 +1096,6 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou const OCopyTableWizard& rWizard = impl_getDialog_throw(); ODatabaseExport::TPositions aColumnPositions = rWizard.GetColumnPositions(); - bool bAutoIncrement = rWizard.shouldCreatePrimaryKey(); Reference< XRow > xRow ( _rxSourceResultSet, UNO_QUERY_THROW ); Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY_THROW ); @@ -1168,7 +1167,6 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou aCopyEvent.Error.clear(); try { - bool bInsertAutoIncrement = true; // notify listeners m_aCopyTableListeners.notifyEach( &XCopyTableListener::copyingRow, aCopyEvent ); @@ -1188,19 +1186,10 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou 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 ) - { - xStatementParams->setInt( 1, nRowCount ); - bInsertAutoIncrement = false; - continue; - } - if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= static_cast<sal_Int32>(aSourceColTypes.size()) ) ) { // ( we have to check here against 1 because the parameters are 1 based) ::dbtools::throwSQLException("Internal error: invalid column type index.", commit fa177231cd20bf3c3f4bb9b50f6646da139c6766 Author: Tamas Bunth <tamas.bu...@collabora.co.uk> AuthorDate: Fri Aug 30 14:57:31 2019 +0200 Commit: Tamás Bunth <btom...@gmail.com> CommitDate: Sat Aug 31 19:43:25 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> 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 3c2a25af6a14..5f25b06ef784 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