Kaydet (Commit) 22576cf6 authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt

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
üst 46694750
......@@ -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 \
......
/* -*- 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
/* -*- 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: */
......@@ -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 -----------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment