User: obo Date: 2006/07/10 08:23:13 Modified: dba/dbaccess/source/ui/app/AppControllerGen.cxx
Log: INTEGRATION: CWS qiq (1.17.24); FILE MERGED 2006/06/27 12:11:55 fs 1.17.24.5: RESYNC: (1.17-1.18); FILE MERGED 2006/05/24 06:49:21 fs 1.17.24.4: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/18 09:16:12 fs 1.17.24.3: #i51143# when creating/pasting/saving a table/query, care for name collisions with both tables and queries (usign a DynamicTableOrQueryNameCheck), if the database supports queries in queries 2006/05/17 11:43:31 fs 1.17.24.2: refactored OSaveAsDlg in preparation of #i51143# 2006/05/12 14:34:42 fs 1.17.24.1: #i51143# when creating a view from a query, substitute sub queries File Changes: Directory: /dba/dbaccess/source/ui/app/ ======================================= File [changed]: AppControllerGen.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerGen.cxx?r1=1.18&r2=1.19 Delta lines: +30 -37 --------------------- --- AppControllerGen.cxx 20 Jun 2006 02:53:53 -0000 1.18 +++ AppControllerGen.cxx 10 Jul 2006 15:23:11 -0000 1.19 @@ -129,6 +129,9 @@ #ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_ #include <com/sun/star/util/XCloseable.hpp> #endif +#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX +#include "defaultobjectnamecheck.hxx" +#endif //........................................................................ namespace dbaui @@ -153,45 +156,34 @@ try { SharedConnection xConnection( getConnection() ); - Reference<XQueriesSupplier> xSup(xConnection,UNO_QUERY); - if ( xSup.is() ) - { - Reference<XNameAccess> xQueries = xSup->getQueries(); - if ( xQueries.is() && xQueries->hasByName(_sName) ) - { - Reference<XPropertySet> xSourceObject(xQueries->getByName( _sName ),UNO_QUERY); + Reference< XQueriesSupplier > xSup( xConnection, UNO_QUERY_THROW ); + Reference< XNameAccess > xQueries( xSup->getQueries(), UNO_QUERY_THROW ); + Reference< XPropertySet > xSourceObject( xQueries->getByName( _sName ), UNO_QUERY_THROW ); - OSL_ENSURE(xSourceObject.is(),"Query is NULL!"); - if ( xSourceObject.is() ) - { - Reference<XTablesSupplier> xTablesSup(xConnection,UNO_QUERY); - Reference<XNameAccess> xTables; - if ( xTablesSup.is() ) - xTables = xTablesSup->getTables(); + Reference< XTablesSupplier > xTablesSup( xConnection, UNO_QUERY_THROW ); + Reference< XNameAccess > xTables( xTablesSup->getTables(), UNO_QUERY_THROW ); - Reference<XDatabaseMetaData > xMeta = xConnection->getMetaData(); + Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData(); String aName = String(ModuleRes(STR_TBL_TITLE)); aName = aName.GetToken(0,' '); String aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName); - OSaveAsDlg aDlg(getView(),CommandType::TABLE,xTables,xMeta,xConnection,aDefaultName); + DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE ); + OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker ); if ( aDlg.Execute() == RET_OK ) { ::rtl::OUString sName = aDlg.getName(); ::rtl::OUString sCatalog = aDlg.getCatalog(); ::rtl::OUString sSchema = aDlg.getSchema(); - ::rtl::OUString sNewName; - ::dbtools::composeTableName(xMeta,sCatalog,sSchema,sName,sNewName,sal_False,::dbtools::eInTableDefinitions); + ::rtl::OUString sNewName( + ::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, sal_False, ::dbtools::eInTableDefinitions ) ); Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject); if ( !xView.is() ) throw SQLException(String(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE)),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")) ,0,Any()); getContainer()->elementAdded(E_TABLE,sNewName,makeAny(xView),xConnection); } } - } - } - } catch(SQLContext& e) { showError(SQLExceptionInfo(e)); } catch(SQLWarning& e) { showError(SQLExceptionInfo(e)); } catch(SQLException& e) { showError(SQLExceptionInfo(e)); } @@ -547,6 +539,7 @@ { Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY); return dbaui::insertHierachyElement(getView() + ,getORB() ,xNames ,_sParentFolder ,_eType == E_FORM --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
