User: obo Date: 2006/07/10 08:36:37 Modified: dba/dbaccess/source/ui/misc/WCPage.cxx
Log: INTEGRATION: CWS qiq (1.24.124); FILE MERGED 2006/06/27 12:46:43 fs 1.24.124.2: RESYNC: (1.24-1.25); FILE MERGED 2006/05/18 09:18:00 fs 1.24.124.1: #i51143# dbumiscres.src File Changes: Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: WCPage.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/WCPage.cxx?r1=1.25&r2=1.26 Delta lines: +35 -30 --------------------- --- WCPage.cxx 20 Jun 2006 03:21:35 -0000 1.25 +++ WCPage.cxx 10 Jul 2006 15:36:35 -0000 1.26 @@ -36,6 +36,9 @@ #ifndef DBAUI_WIZARD_CPAGE_HXX #include "WCPage.hxx" #endif +#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX +#include "defaultobjectnamecheck.hxx" +#endif #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif @@ -54,6 +57,9 @@ #ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ #include <com/sun/star/sdbc/XResultSet.hpp> #endif +#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ +#include <com/sun/star/sdb/CommandType.hpp> +#endif #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> #endif @@ -75,6 +81,9 @@ #ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" #endif +#ifndef _CPPUHELPER_EXC_HLP_HXX_ +#include <cppuhelper/exc_hlp.hxx> +#endif using namespace ::dbaui; using namespace ::dbtools; @@ -82,6 +91,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::util; +using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; //======================================================================== @@ -134,9 +144,9 @@ } } } - catch(const SQLException& e) + catch(const SQLException&) { - ::dbaui::showError(SQLExceptionInfo(e),pParent->GetParent(),m_pParent->m_xFactory); + ::dbaui::showError( SQLExceptionInfo( ::cppu::getCaughtException() ), m_pParent, m_pParent->m_xFactory ); } } @@ -264,20 +274,16 @@ // first check if the table already exists in the database if( m_pParent->getCreateStyle() != OCopyTableWizard::WIZARD_APPEND_DATA ) { - 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()) ) - { - String aInfoString( ModuleRes(STR_ERR_DUPL_TABLENAME) ); - aInfoString.SearchAndReplaceAscii("$name$",m_edTableName.GetText()); - InfoBox aNameInfoBox( this, aInfoString ); - aNameInfoBox.Execute(); + DynamicTableOrQueryNameCheck aNameCheck( m_pParent->m_xConnection, CommandType::TABLE ); + SQLExceptionInfo aErrorInfo; + if ( !aNameCheck.isNameValid( m_edTableName.GetText(), aErrorInfo ) ) + { + aErrorInfo.append( SQLExceptionInfo::SQL_CONTEXT, String( ModuleRes( STR_SUGGEST_APPEND_TABLE_DATA ) ) ); + ::dbaui::showError( aErrorInfo, m_pParent, m_pParent->m_xFactory ); return sal_False; } - else // we have to check the length of the table name - { + + // have to check the length of the table name Reference<XDatabaseMetaData> xMeta = m_pParent->m_xConnection->getMetaData(); ::rtl::OUString sCatalog; ::rtl::OUString sSchema; @@ -293,7 +299,6 @@ { ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME_LENGTH)).Execute(); return sal_False; - } } // now we have to check if the name of the primary key already exists --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
