diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-12-07 12:12:29 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-12-07 12:12:29 +0000 |
commit | 6bc4e146fea818be9aa30d073ea5e362f5a8029e (patch) | |
tree | e205a79519c958fbc59c453d7f78bb1ba6465767 /dbaccess/source/ui | |
parent | 9885cbfb3f1c940514cb0f6d8593da66d028fb32 (diff) |
#95728# check if append only was selected and set columns
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r-- | dbaccess/source/ui/inc/WCPage.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCPage.cxx | 82 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WNameMatch.cxx | 13 |
4 files changed, 58 insertions, 57 deletions
diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx index 2c3941797..3e6578543 100644 --- a/dbaccess/source/ui/inc/WCPage.hxx +++ b/dbaccess/source/ui/inc/WCPage.hxx @@ -2,9 +2,9 @@ * * $RCSfile: WCPage.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fme $ $Date: 2001-06-21 15:21:14 $ + * last change: $Author: oj $ $Date: 2001-12-07 13:12:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,6 +117,8 @@ namespace dbaui DECL_LINK( RadioChangeHdl, Button* ); DECL_LINK( KeyClickHdl, Button* ); + sal_Bool checkAppendData(); + public: virtual void Reset(); virtual void ActivatePage(); diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index 4a6417f00..ab69eab81 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WCPage.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-11-06 12:50:08 $ + * last change: $Author: oj $ $Date: 2001-12-07 13:12:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -288,26 +288,8 @@ sal_Bool OCopyTable::LeavePage() { // table exists and name has changed if(m_pParent->getCreateStyle() == OCopyTableWizard::WIZARD_APPEND_DATA) { - m_pParent->clearDestColumns(); - // m_pParent->m_xSourceObject = NULL; - m_pParent->m_xDestObject = NULL; - Reference<XTablesSupplier > xSup(m_pParent->m_xConnection,UNO_QUERY); - Reference<XNameAccess> xTables; - if(xSup.is()) - xTables = xSup->getTables(); - if(xTables.is() && xTables->hasByName(m_edTableName.GetText())) - { - // set new destination - xTables->getByName(m_edTableName.GetText()) >>= m_pParent->m_xDestObject; - m_pParent->loadData(m_pParent->m_xDestObject,m_pParent->m_vDestColumns,m_pParent->m_aDestVec); - // #90027# - // m_pParent->CheckColumns(); - } - if(!m_pParent->m_xDestObject.is()) - { - ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME)).Execute(); + if(!checkAppendData()) return sal_False; - } } else if(m_eOldStyle == OCopyTableWizard::WIZARD_APPEND_DATA) { @@ -322,28 +304,8 @@ sal_Bool OCopyTable::LeavePage() { case OCopyTableWizard::WIZARD_APPEND_DATA: { - m_pParent->clearDestColumns(); - // m_pParent->m_xSourceObject = NULL; - m_pParent->m_xDestObject = NULL; - Reference<XTablesSupplier > xSup(m_pParent->m_xConnection,UNO_QUERY); - Reference<XNameAccess> xTables; - if(xSup.is()) - xTables = xSup->getTables(); - if(xTables.is() && xTables->hasByName(m_edTableName.GetText())) - { - xTables->getByName(m_edTableName.GetText()) >>= m_pParent->m_xDestObject; - m_pParent->loadData(m_pParent->m_xDestObject,m_pParent->m_vDestColumns,m_pParent->m_aDestVec); - // m_pParent->loadData(); - // #90027# - // m_pParent->CheckColumns(); - } - - if(!m_pParent->m_xDestObject.is()) - { - ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME)).Execute(); - m_edTableName.GrabFocus(); + if(!checkAppendData()) return sal_False; - } break; } case OCopyTableWizard::WIZARD_DEF_DATA: @@ -402,3 +364,39 @@ void OCopyTable::Reset() m_edTableName.SaveValue(); } //------------------------------------------------------------------------ +sal_Bool OCopyTable::checkAppendData() +{ + m_pParent->clearDestColumns(); + m_pParent->m_xDestObject = NULL; + Reference<XTablesSupplier > xSup(m_pParent->m_xConnection,UNO_QUERY); + Reference<XNameAccess> xTables; + if(xSup.is()) + xTables = xSup->getTables(); + if(xTables.is() && xTables->hasByName(m_edTableName.GetText())) + { + // set new destination + xTables->getByName(m_edTableName.GetText()) >>= m_pParent->m_xDestObject; + m_pParent->loadData(m_pParent->m_xDestObject,m_pParent->m_vDestColumns,m_pParent->m_aDestVec); + // #90027# + const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector(); + ODatabaseExport::TColumnVector::const_iterator aDestIter = pDestColumns->begin(); + m_pParent->m_vColumnPos.reserve(pDestColumns->size()+1); + m_pParent->m_vColumnTypes.reserve(pDestColumns->size()+1); + for(sal_Int32 nPos = 1;aDestIter != pDestColumns->end();++aDestIter,++nPos) + { + m_pParent->m_vColumnPos.push_back(nPos); + const OTypeInfo* pTypeInfo = m_pParent->convertType((*aDestIter)->second->getTypeInfo()); + if(pTypeInfo) + m_pParent->m_vColumnTypes.push_back(pTypeInfo->nType); + else + m_pParent->m_vColumnTypes.push_back(DataType::VARCHAR); + } + } + if(!m_pParent->m_xDestObject.is()) + { + ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME)).Execute(); + return sal_False; + } + return sal_True; +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index aeed8b552..c9f8950d5 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WCopyTable.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-12-05 09:03:01 $ + * last change: $Author: oj $ $Date: 2001-12-07 13:12:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -389,21 +389,15 @@ IMPL_LINK( OCopyTableWizard, ImplOKHdl, OKButton*, EMPTYARG ) if(bFinish) { WaitObject aWait(this); - sal_Bool bWasEmpty = !m_vDestColumns.size(); - if(getCreateStyle() != WIZARD_DEF_VIEW && getCreateStyle() != WIZARD_APPEND_DATA ) - CheckColumns(); - switch(getCreateStyle()) { - case WIZARD_APPEND_DATA: - { - break; - } case WIZARD_DEF_DATA: case WIZARD_DEF: { + CheckColumns(); break; } + case WIZARD_APPEND_DATA: case WIZARD_DEF_VIEW: break; default: diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx index 380fab795..5a5723645 100644 --- a/dbaccess/source/ui/misc/WNameMatch.cxx +++ b/dbaccess/source/ui/misc/WNameMatch.cxx @@ -2,9 +2,9 @@ * * $RCSfile: WNameMatch.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-08-08 08:24:54 $ + * last change: $Author: oj $ $Date: 2001-12-07 13:12:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,6 +88,9 @@ #ifndef DBAUI_WIZ_COPYTABLEDIALOG_HXX #include "WCopyTable.hxx" #endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif using namespace ::dbaui; //======================================================================== @@ -216,7 +219,11 @@ sal_Bool OWizNameMatching::LeavePage() break; m_pParent->m_vColumnPos[nPos] = pDestColumns->end() - aDestIter; - m_pParent->m_vColumnTypes[nPos] = pDestField->GetType(); + const OTypeInfo* pTypeInfo = m_pParent->convertType((*aDestIter)->second->getTypeInfo()); + sal_Int32 nType = ::com::sun::star::sdbc::DataType::VARCHAR; + if(pTypeInfo) + nType = pTypeInfo->nType; + m_pParent->m_vColumnTypes[nPos] = nType; } else m_pParent->m_vColumnPos[nPos] = CONTAINER_ENTRY_NOTFOUND; |