diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-15 11:33:54 +0100 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-08-15 20:31:14 +0100 |
commit | c68aedab311f6a85857113bcd92fdfe51f089507 (patch) | |
tree | 7e3c0aafaf0380af4d7c760325e7d2df48288d68 | |
parent | 6cb1f56fced634e0692c82cd9b2c7d240a32c14b (diff) |
Implement dropping tables. (firebird-sdbc)
Change-Id: I68ef5bdfb3007709444b838f3c7c3925acc9dd32
-rw-r--r-- | connectivity/source/drivers/firebird/Tables.cxx | 35 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Tables.hxx | 12 |
2 files changed, 24 insertions, 23 deletions
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx index 52657038daf0..fc55d2ae5d13 100644 --- a/connectivity/source/drivers/firebird/Tables.cxx +++ b/connectivity/source/drivers/firebird/Tables.cxx @@ -96,18 +96,25 @@ ObjectType Tables::appendObject(const OUString& rName, return createObject(rName); } -// //----- XDrop ---------------------------------------------------------------- -// void SAL_CALL Tables::dropByName(const OUString& rName) -// throw (SQLException, NoSuchElementException, RuntimeException) -// { -// (void) rName; -// // TODO: IMPLEMENT ME -// } -// -// void SAL_CALL Tables::dropByIndex(const sal_Int32 nIndex) -// throw (SQLException, IndexOutOfBoundsException, RuntimeException) -// { -// (void) nIndex; -// // TODO: IMPLEMENT ME -// } + +//----- XDrop ----------------------------------------------------------------- +void Tables::dropObject(sal_Int32 nPosition, const OUString sName) +{ + uno::Reference< XPropertySet > xTable(getObject(nPosition)); + + if (!ODescriptor::isNew(xTable)) + { + OUStringBuffer sSql("DROP "); + + OUString sType; + xTable->getPropertyValue("Type") >>= sType; + sSql.append(sType); + + const OUString sQuoteString = m_xMetaData->getIdentifierQuoteString(); + sSql.append(::dbtools::quoteName(sQuoteString,sName)); + + m_xMetaData->getConnection()->createStatement()->execute(sSql.makeStringAndClear()); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/connectivity/source/drivers/firebird/Tables.hxx b/connectivity/source/drivers/firebird/Tables.hxx index 173d957158ef..b2e570f9ff92 100644 --- a/connectivity/source/drivers/firebird/Tables.hxx +++ b/connectivity/source/drivers/firebird/Tables.hxx @@ -52,15 +52,9 @@ namespace connectivity // TODO: we should also implement XDataDescriptorFactory, XRefreshable, // XAppend, etc., but all are optional. -// // XDrop -// virtual void SAL_CALL dropByName(const ::rtl::OUString& rName) -// throw (::com::sun::star::sdbc::SQLException, -// ::com::sun::star::container::NoSuchElementException, -// ::com::sun::star::uno::RuntimeException); -// virtual void SAL_CALL dropByIndex(const sal_Int32 nIndex) -// throw (::com::sun::star::sdbc::SQLException, -// com::sun::star::lang::IndexOutOfBoundsException, -// ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void dropObject(sal_Int32 nPosition, const ::rtl::OUString rName); + }; } // namespace firebird |