diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-09-06 11:34:09 +0100 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-09-06 21:27:57 +0100 |
commit | 22576cf6d883f0708560f403c2f05b318c0eab14 (patch) | |
tree | f1b34f863a6efca6beaae5331edc96344e41b2ce /connectivity | |
parent | 466947504a82b4a4e6668aeb2de5c736fbd99c67 (diff) |
Extend OIndexesHelper::dropObject to use correct DROP INDEX. (firebird-sdbc)
Firebird's DROP INDEX statements only need to contain the index name, including
the table name causes an error.
Change-Id: I5b61d82bda7176148f7849e31bd050e025f84e02
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/Library_firebird_sdbc.mk | 1 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Indexes.cxx | 33 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Indexes.hxx | 45 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Table.cxx | 8 |
4 files changed, 83 insertions, 4 deletions
diff --git a/connectivity/Library_firebird_sdbc.mk b/connectivity/Library_firebird_sdbc.mk index 2391349a6cc7..b1fbf7923c39 100644 --- a/connectivity/Library_firebird_sdbc.mk +++ b/connectivity/Library_firebird_sdbc.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Library_add_exception_objects,firebird_sdbc,\ connectivity/source/drivers/firebird/Connection \ connectivity/source/drivers/firebird/DatabaseMetaData \ connectivity/source/drivers/firebird/Driver \ + connectivity/source/drivers/firebird/Indexes \ connectivity/source/drivers/firebird/Keys \ connectivity/source/drivers/firebird/PreparedStatement \ connectivity/source/drivers/firebird/ResultSet \ diff --git a/connectivity/source/drivers/firebird/Indexes.cxx b/connectivity/source/drivers/firebird/Indexes.cxx new file mode 100644 index 000000000000..fc03272674f4 --- /dev/null +++ b/connectivity/source/drivers/firebird/Indexes.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "Indexes.hxx" + +using namespace ::connectivity; +using namespace ::connectivity::firebird; + +using namespace ::osl; +using namespace ::rtl; +using namespace ::std; + +using namespace ::com::sun::star; +using namespace ::com::sun::star::sdbc; + +Indexes::Indexes(Table* pTable, Mutex& rMutex, const vector< OUString>& rVector) + : OIndexesHelper(pTable, rMutex, rVector) + , m_pTable(pTable) +{ +} + +// XDrop +void Indexes::dropObject(sal_Int32 /*nPosition*/, const OUString sIndexName) +{ + OUString sSql("DROP INDEX \"" + sIndexName +"\""); + m_pTable->getConnection()->createStatement()->execute(sSql); +}
\ No newline at end of file diff --git a/connectivity/source/drivers/firebird/Indexes.hxx b/connectivity/source/drivers/firebird/Indexes.hxx new file mode 100644 index 000000000000..32d035c1edfb --- /dev/null +++ b/connectivity/source/drivers/firebird/Indexes.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef CONNECTIVITY_FIREBIRD_INDEXES_HXX +#define CONNECTIVITY_FIREBIRD_INDEXES_HXX + +#include "Table.hxx" + +#include <connectivity/TIndexes.hxx> + +namespace connectivity +{ + namespace firebird + { + + /** + * Firebird has a non-standard DROP INDEX statement, hence we need + * to override OIndexesHelper::dropObject + */ + class Indexes: public ::connectivity::OIndexesHelper + { + private: + Table* m_pTable; + protected: + // XDrop + virtual void dropObject(sal_Int32 nPosition, + const ::rtl::OUString sIndexName); + public: + Indexes(Table* pTable, + ::osl::Mutex& rMutex, + const ::std::vector< ::rtl::OUString>& rVector); + }; + + } // namespace firebird +} // namespace connectivity + +#endif // CONNECTIVITY_FIREBIRD_INDEXES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx index 98e446b590cd..2b9d5787f0b9 100644 --- a/connectivity/source/drivers/firebird/Table.cxx +++ b/connectivity/source/drivers/firebird/Table.cxx @@ -8,6 +8,7 @@ */ #include "Columns.hxx" +#include "Indexes.hxx" #include "Keys.hxx" #include "Table.hxx" @@ -15,7 +16,6 @@ #include <comphelper/sequence.hxx> #include <connectivity/dbtools.hxx> -#include <connectivity/TIndexes.hxx> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> @@ -105,9 +105,9 @@ OCollection* Table::createKeys(const TStringVector& rNames) OCollection* Table::createIndexes(const TStringVector& rNames) { - return new OIndexesHelper(this, - m_rMutex, - rNames); + return new Indexes(this, + m_rMutex, + rNames); } //----- XAlterTable ----------------------------------------------------------- |