28#include <com/sun/star/lang/WrappedTargetException.hpp>
29#include <com/sun/star/lang/DisposedException.hpp>
30#include <com/sun/star/sdbc/XRow.hpp>
31#include <com/sun/star/sdbc/SQLException.hpp>
42 using ::com::sun::star::uno::Reference;
43 using ::com::sun::star::uno::UNO_QUERY_THROW;
44 using ::com::sun::star::uno::Exception;
45 using ::com::sun::star::uno::RuntimeException;
46 using ::com::sun::star::uno::Any;
47 using ::com::sun::star::sdbc::SQLException;
48 using ::com::sun::star::sdbc::XConnection;
49 using ::com::sun::star::lang::WrappedTargetException;
50 using ::com::sun::star::sdbc::XResultSet;
51 using ::com::sun::star::sdbc::XStatement;
52 using ::com::sun::star::lang::DisposedException;
53 using ::com::sun::star::sdbc::XRow;
55 HView::HView(
const Reference< XConnection >& _rxConnection,
bool _bCaseSensitive,
56 const OUString& _rSchemaName,
const OUString& _rName )
57 :
HView_Base( _bCaseSensitive, _rName, _rxConnection->getMetaData(), OUString(), _rSchemaName, OUString() )
72 void SAL_CALL
HView::alterCommand( const OUString& _rNewCommand )
87 m_xMetaData, m_CatalogName, m_SchemaName,
m_Name,
true, ::dbtools::EComposeRule::InDataManipulation ) );
93 OUString sRestoreCommand =
97 impl_getCommand_throwSQLException();
99 bool bDropSucceeded(
false );
103 OUString
aCommand =
"DROP VIEW " + sQualifiedName;
105 bDropSucceeded =
true;
108 aCommand =
"CREATE VIEW " + sQualifiedName +
" AS " + _rNewCommand;
111 catch(
const SQLException& )
113 if ( bDropSucceeded )
116 xStatement->execute( sRestoreCommand );
121 if ( bDropSucceeded )
122 xStatement->execute( sRestoreCommand );
128 if ( bDropSucceeded )
129 xStatement->execute( sRestoreCommand );
150 "SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.SYSTEM_VIEWS " );
153 Reference< XResultSet > xResult( xStatement->executeQuery(
aCommand.makeStringAndClear() ), css::uno::UNO_SET_THROW );
154 if ( !xResult->next() )
158 throw DisposedException();
161 Reference< XRow > xRow( xResult, UNO_QUERY_THROW );
162 return xRow->getString( 1 );
177 catch(
const SQLException& e )
179 throw WrappedTargetException( e.Message,
static_cast< XAlterView*
>(
const_cast< HView*
>(
this ) ), ::cppu::getCaughtException() );
201 catch(
const SQLException& )
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
OUString impl_getCommand_wrapSQLException() const
retrieves the current command of the View
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &_rValue, sal_Int32 _nHandle) const override
virtual ~HView() override
HView(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, bool _bCaseSensitive, const OUString &_rSchemaName, const OUString &_rName)
OUString impl_getCommand_throwSQLException() const
retrieves the current command of the View
OUString impl_getCommand() const
retrieves the current command of the View
css::uno::Reference< css::sdbc::XConnection > m_xConnection
bool set(const css::uno::BaseReference &_rRef, css::uno::UnoReference_Query _query)
#define DBG_UNHANDLED_EXCEPTION(...)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OHsqlConnection, OHsqlConnection_BASE, OConnectionWrapper)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
Reference< XConnection > m_xConnection
#define PROPERTY_ID_COMMAND