18#include <com/sun/star/sdbc/XRow.hpp>
19#include <com/sun/star/sdbc/ColumnValue.hpp>
31 sal_Int32 nLastIndexBacktick = rName.lastIndexOf(
"`");
32 if ((nLastIndexBacktick > 0) && (nLastIndexBacktick == (rName.getLength() - 1)))
34 rName = rName.copy(0, nLastIndexBacktick);
38 nLastIndexBacktick = rName.indexOf(
"`");
39 if (nLastIndexBacktick == 0)
41 rName = rName.copy(1, rName.getLength() - 1);
45 rName = rName.replaceAll(
"``",
"`");
52 ::dbtools::EComposeRule::InDataManipulation);
54 css::uno::Any aCatalog;
65 css::uno::Reference<css::sdbc::XResultSet> xTables
66 = m_xMetaData->getTables(aCatalog,
sSchema, sTable, css::uno::Sequence<OUString>());
69 throw css::uno::RuntimeException(
"Could not acquire table.");
71 css::uno::Reference<css::sdbc::XRow> xRow(xTables, css::uno::UNO_QUERY_THROW);
74 throw css::uno::RuntimeException();
85 throw css::uno::RuntimeException(
"Found more tables than expected.");
95 return new Table(
this,
m_rMutex, m_xMetaData->getConnection());
100 const css::uno::Reference<css::beans::XPropertySet>& descriptor)
102 const css::uno::Reference<css::sdbc::XConnection> xConnection = m_xMetaData->getConnection();
105 css::uno::Reference<css::sdbc::XStatement> xStmt = xConnection->createStatement();
108 xStmt->execute(aSql);
109 ::comphelper::disposeComponent(xStmt);
115 const OUString& _rForName,
const css::uno::Reference<css::beans::XPropertySet>& descriptor)
117 createTable(descriptor);
118 return createObject(_rForName);
123 insertElement(_rsNewTable,
nullptr);
126 css::container::ContainerEvent
aEvent(
static_cast<XContainer*
>(
this),
127 css::uno::Any(_rsNewTable), css::uno::Any(),
131 aListenerLoop.
next()->elementInserted(
aEvent);
137 OSL_ENSURE(_xObject.is(),
"OTables::getNameForObject: Object is NULL!");
139 ::dbtools::EComposeRule::InDataManipulation,
false)
140 .replaceAll(
u"`",
u"̀ `");
146 css::uno::Reference<css::beans::XPropertySet> xTable(getObject(nPosition));
152 xTable->getPropertyValue(
"Type") >>=
sType;
154 m_xMetaData->getConnection()->createStatement()->execute(
"DROP " +
sType +
" " +
sName);
bool hasMoreElements() const
css::uno::Reference< ListenerT > const & next()
void createTable(const css::uno::Reference< css::beans::XPropertySet > &descriptor)
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override
virtual ::connectivity::sdbcx::ObjectType createObject(const OUString &rName) override
virtual void dropObject(sal_Int32 nPosition, const OUString &rName) override
virtual void impl_refresh() override
void appendNew(const OUString &_rsNewTable)
virtual OUString getNameForObject(const sdbcx::ObjectType &_xObject) override
returns the name for the object.
virtual ::connectivity::sdbcx::ObjectType appendObject(const OUString &rName, const css::uno::Reference< css::beans::XPropertySet > &rDescriptor) override
appends an object described by a descriptor, under a given name
::cppu::OWeakObject & m_rParent
static void lcl_unescape(OUString &rName)
css::uno::Reference< css::beans::XPropertySet > ObjectType