23#include <com/sun/star/sdbc/XRow.hpp>
24#include <com/sun/star/sdbc/XResultSet.hpp>
25#include <com/sun/star/sdbcx/Privilege.hpp>
33using namespace ::
cppu;
47 ::dbtools::EComposeRule::InDataManipulation);
49 Sequence<OUString> sTableTypes{
56 Reference<XResultSet> xResult =
m_xMetaData->getTables(aCatalog, sSchema, sTable, sTableTypes);
61 Reference<XRow> xRow(xResult, UNO_QUERY);
64 sal_Int32
const nPrivileges = Privilege::DROP | Privilege::REFERENCE | Privilege::ALTER
65 | Privilege::CREATE | Privilege::READ | Privilege::DELETE
66 | Privilege::UPDATE | Privilege::INSERT
70 sTable, xRow->getString(4), xRow->getString(5), sSchema,
71 sCatalog, nPrivileges);
73 ::comphelper::disposeComponent(xResult);
94 const Reference<XPropertySet>& descriptor)
103 Reference<XInterface> xObject(
getObject(_nPos));
112 ::dbtools::EComposeRule::InDataManipulation);
114 OUString aSql(
"DROP ");
116 Reference<XPropertySet> xProp(xObject, UNO_QUERY);
117 bool bIsView = xProp.is()
118 && ::comphelper::getString(xProp->getPropertyValue(
127 m_xMetaData, sCatalog, sSchema, sTable,
true, ::dbtools::EComposeRule::InDataManipulation));
129 Reference<XStatement> xStmt = xConnection->createStatement();
132 xStmt->execute(aSql);
133 ::comphelper::disposeComponent(xStmt);
140 if (pViews && pViews->
hasByName(_sElementName))
145OUString OTables::adjustSQL(
const OUString& _sSql)
147 OUString sSQL = _sSql;
148 static const char s_sUNSIGNED[] =
"UNSIGNED";
149 sal_Int32
nIndex = sSQL.indexOf(s_sUNSIGNED);
152 sal_Int32 nParen = sSQL.indexOf(
')',
nIndex);
153 sal_Int32
nPos =
nIndex + strlen(s_sUNSIGNED);
154 OUString sNewUnsigned(sSQL.copy(
nPos, nParen -
nPos + 1));
155 sSQL = sSQL.replaceAt(
nIndex, strlen(s_sUNSIGNED) + sNewUnsigned.getLength(),
156 rtl::Concat2View(sNewUnsigned + s_sUNSIGNED));
157 nIndex = sSQL.indexOf(s_sUNSIGNED,
nIndex + strlen(s_sUNSIGNED) + sNewUnsigned.getLength());
164 const Reference<XConnection> xConnection
168 Reference<XStatement> xStmt = xConnection->createStatement();
171 xStmt->execute(aSql);
172 ::comphelper::disposeComponent(xStmt);
181 ContainerEvent
aEvent(
static_cast<XContainer*
>(
this),
Any(_rsNewTable),
Any(),
Any());
183 while (aListenerLoop.hasMoreElements())
184 aListenerLoop.next()->elementInserted(aEvent);
189 OSL_ENSURE(_xObject.is(),
"OTables::getNameForObject: Object is NULL!");
191 ::dbtools::EComposeRule::InDataManipulation,
false);
194void OTables::addComment(
const Reference<XPropertySet>& descriptor, OUStringBuffer& _rOut)
197 descriptor->getPropertyValue(
200 if (!sDesc.isEmpty())
202 _rOut.append(
" COMMENT '");
OptionalString sComposedName
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
void createTable(const css::uno::Reference< css::beans::XPropertySet > &descriptor)
virtual void disposing() override
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override
virtual void impl_refresh() override
virtual void dropObject(sal_Int32 _nPos, const OUString &_sElementName) override
virtual sdbcx::ObjectType appendObject(const OUString &_rForName, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
appends an object described by a descriptor, under a given name
void appendNew(const OUString &_rsNewTable)
virtual OUString getNameForObject(const sdbcx::ObjectType &_xObject) override
returns the name for the object.
virtual sdbcx::ObjectType createObject(const OUString &_rName) override
void dropByNameImpl(const OUString &elementName)
void insertElement(const OUString &_sElementName, const ObjectType &_xElement)
insert a new element into the collection
ObjectType getObject(sal_Int32 _nIndex)
return the object, if not existent it creates it.
::cppu::OWeakObject & m_rParent
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
::comphelper::OInterfaceContainerHelper3< css::container::XContainerListener > m_aContainerListeners
css::uno::Reference< css::beans::XPropertySet > ObjectType
#define PROPERTY_ID_DESCRIPTION