23#include <bitmaps.hlst>
27#include <com/sun/star/container/XNameAccess.hpp>
28#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
29#include <com/sun/star/sdbc/XRow.hpp>
30#include <com/sun/star/graphic/GraphicProvider.hpp>
31#include <com/sun/star/graphic/XGraphicProvider.hpp>
32#include <com/sun/star/beans/PropertyValue.hpp>
33#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
37#include <rtl/ustrbuf.hxx>
44using ::com::sun::star::util::XFlushListener;
45using ::com::sun::star::lang::EventObject;
46using ::com::sun::star::uno::Reference;
47using ::com::sun::star::uno::Exception;
48using ::com::sun::star::uno::RuntimeException;
49using ::com::sun::star::uno::UNO_QUERY;
50using ::com::sun::star::uno::UNO_QUERY_THROW;
51using ::com::sun::star::uno::XComponentContext;
52using ::com::sun::star::sdbc::XStatement;
53using ::com::sun::star::sdbc::XConnection;
54using ::com::sun::star::sdbcx::XDataDefinitionSupplier;
55using ::com::sun::star::sdbcx::XTablesSupplier;
56using ::com::sun::star::container::XNameAccess;
57using ::com::sun::star::uno::Sequence;
58using ::com::sun::star::lang::WrappedTargetException;
59using ::com::sun::star::sdbc::XDriver;
60using ::com::sun::star::graphic::XGraphic;
61using ::com::sun::star::graphic::GraphicProvider;
62using ::com::sun::star::graphic::XGraphicProvider;
63using ::com::sun::star::uno::XInterface;
64using ::com::sun::star::lang::IllegalArgumentException;
65using ::com::sun::star::sdbc::XResultSet;
66using ::com::sun::star::sdbc::XDatabaseMetaData;
67using ::com::sun::star::sdbc::XDatabaseMetaData2;
68using ::com::sun::star::sdbc::XRow;
69using ::com::sun::star::sdb::application::XDatabaseDocumentUI;
70using ::com::sun::star::beans::PropertyValue;
78 OHsqlConnection_BASE::disposing();
83 const Reference< XConnection >& _xConnection ,
const Reference< XComponentContext >& _rxContext )
86 ,m_xDriver( _rxDriver )
96 if ( !OHsqlConnection_BASE::rBHelper.bDisposed )
123 MethodGuard aGuard( *
this );
132 Reference< XDatabaseMetaData2 > xMeta2(
m_xConnection->getMetaData(),UNO_QUERY_THROW);
133 const Sequence< PropertyValue > aInfo = xMeta2->getConnectionInfo();
134 const PropertyValue* pIter = aInfo.getConstArray();
135 const PropertyValue* pEnd = pIter + aInfo.getLength();
136 for(;pIter != pEnd;++pIter)
138 if ( pIter->Name ==
"readonly" )
146 Reference< XStatement > xStmt(
m_xConnection->createStatement(), css::uno::UNO_SET_THROW );
147 xStmt->execute(
"CHECKPOINT DEFRAG" );
150 catch(
const Exception& )
156 EventObject aFlushedEvent( *
this );
159 catch(
const Exception& )
200 if ( !DocumentUI.is() )
204 throw IllegalArgumentException(
221 Reference< XNameAccess > xTables;
224 Reference< XConnection > xMe( *
this, UNO_QUERY );
225 Reference< XDataDefinitionSupplier > xDefinitionsSupp(
m_xDriver, UNO_QUERY_THROW );
226 Reference< XTablesSupplier > xTablesSupp( xDefinitionsSupp->getDataDefinitionByConnection( xMe ), css::uno::UNO_SET_THROW );
227 xTables.set( xTablesSupp->getTables(), css::uno::UNO_SET_THROW );
235 throw WrappedTargetException( sError ,*
this, anyEx );
238 SAL_WARN_IF( !xTables.is(),
"connectivity.hsqldb",
"OHsqlConnection::impl_getTableContainer_throw: post condition not met!" );
246 bool bDoesExist =
false;
250 bDoesExist = xTables->hasByName( _rTableName );
264 "$tablename$", _rTableName
266 throw IllegalArgumentException( sError,*
this, 0 );
273 bool bIsTextTable =
false;
276 Reference< XConnection > xMe( *
this, UNO_QUERY_THROW );
279 Reference< XDatabaseMetaData > xMetaData( xMe->getMetaData(), css::uno::UNO_SET_THROW );
284 OUStringBuffer sSQL(
"SELECT HSQLDB_TYPE FROM INFORMATION_SCHEMA.SYSTEM_TABLES" );
286 sSQL.append(
" AND TABLE_TYPE = 'TABLE'" );
288 Reference< XStatement > xStatement( xMe->createStatement(), css::uno::UNO_SET_THROW );
289 Reference< XResultSet > xTableHsqlType( xStatement->executeQuery( sSQL.makeStringAndClear() ), css::uno::UNO_SET_THROW );
291 if ( xTableHsqlType->next() )
293 Reference< XRow > xValueAccess( xTableHsqlType, UNO_QUERY_THROW );
294 OUString sTableType = xValueAccess->getString( 1 );
295 bIsTextTable = sTableType ==
"TEXT";
309 Reference< XGraphic > xGraphic;
313 Reference< XGraphicProvider > xProvider;
315 xProvider.set( GraphicProvider::create(
m_xContext) );
321 "private:graphicrepository/"
323 LINKED_TEXT_TABLE_IMAGE_RESOURCE)) };
324 xGraphic = xProvider->queryGraphic( aMediaProperties );
325 OSL_ENSURE( xGraphic.is(),
"OHsqlConnection::impl_getTextTableIcon_nothrow: the provider did not give us a graphic object!" );
Reference< XComponentContext > m_xContext
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
void setDelegation(css::uno::Reference< css::uno::XAggregation > &_rxProxyConnection, oslInterlockedCount &_rRefCount)
css::uno::Reference< css::sdbc::XConnection > m_xConnection
helper class for accessing resources shared by different libraries in the connectivity module
OUString getResourceString(TranslateId pResId) const
loads a string from the shared resource file
OUString getResourceStringWithSubstitution(TranslateId pResId, const char *_pAsciiPatternToReplace, const OUString &_rStringToSubstitute) const
loads a string from the shared resource file, and replaces a given ASCII pattern with a given string
css::uno::Reference< css::sdbc::XDriver > m_xDriver
virtual void checkDisposed() const override
css::uno::Reference< css::container::XNameAccess > impl_getTableContainer_throw()
retrieves our table container
virtual ~OHsqlConnection() override
OHsqlConnection(const css::uno::Reference< css::sdbc::XDriver > &_rxDriver, const css::uno::Reference< css::sdbc::XConnection > &_xConnection, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual void SAL_CALL removeFlushListener(const css::uno::Reference< css::util::XFlushListener > &l) override
virtual void SAL_CALL disposing() override
css::uno::Reference< css::graphic::XGraphic > impl_getTextTableIcon_nothrow()
retrieves the icon for HSQL TEXT TABLEs
bool impl_isTextTable_nothrow(const OUString &_rTableName)
checks whether the given table name refers to a HSQL TEXT TABLE
void impl_checkExistingTable_throw(const OUString &_rTableName)
checks whether the given table name denotes an existing table
virtual void SAL_CALL flush() override
virtual void SAL_CALL addFlushListener(const css::uno::Reference< css::util::XFlushListener > &l) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getTableEditor(const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI > &DocumentUI, const OUString &TableName) override
::comphelper::OInterfaceContainerHelper2 m_aFlushListeners
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getTableIcon(const OUString &TableName, ::sal_Int32 ColorMode) override
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_WARN_IF(condition, area, stream)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
::cppu::WeakComponentImplHelper< css::util::XFlushable, css::sdb::application::XTableUIProvider > OHsqlConnection_BASE
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OHsqlConnection, OHsqlConnection_BASE, OConnectionWrapper)
void checkDisposed(bool _bThrow)
Any SAL_CALL getCaughtException()
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)