summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/ConnectionI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Freeze/ConnectionI.cpp')
-rw-r--r--cpp/src/Freeze/ConnectionI.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/cpp/src/Freeze/ConnectionI.cpp b/cpp/src/Freeze/ConnectionI.cpp
index 7bd9a114f13..824fc167c9c 100644
--- a/cpp/src/Freeze/ConnectionI.cpp
+++ b/cpp/src/Freeze/ConnectionI.cpp
@@ -40,6 +40,39 @@ Freeze::ConnectionI::currentTransaction() const
}
void
+Freeze::ConnectionI::removeMapIndex(const string& mapName, const string& indexName)
+{
+ if(_dbEnv == 0)
+ {
+ throw DatabaseException(__FILE__, __LINE__, "Closed connection");
+ }
+
+ string filename = mapName + "." + indexName;
+
+ DbTxn* txn = dbTxn();
+ try
+ {
+ _dbEnv->getEnv()->dbremove(txn, filename.c_str(), 0, txn != 0 ? 0 : DB_AUTO_COMMIT);
+ }
+ catch(const DbDeadlockException& dx)
+ {
+ throw DeadlockException(__FILE__, __LINE__, dx.what());
+ }
+ catch(const DbException& dx)
+ {
+ if(dx.get_errno() == ENOENT)
+ {
+ throw IndexNotFoundException(__FILE__, __LINE__, mapName, indexName);
+ }
+ else
+ {
+ throw DatabaseException(__FILE__, __LINE__, dx.what());
+ }
+ }
+}
+
+
+void
Freeze::ConnectionI::close()
{
if(_transaction)