mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 22:22:00 +00:00
36 lines
645 B
C++
36 lines
645 B
C++
#include <DB/Storages/StoragePtr.h>
|
|
#include <DB/Storages/IStorage.h>
|
|
#include <Yandex/logger_useful.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
StoragePtr::Wrapper::Wrapper() {}
|
|
|
|
StoragePtr::Wrapper::Wrapper(IStorage * s) : storage(s) {}
|
|
|
|
StoragePtr::Wrapper::~Wrapper()
|
|
{
|
|
try
|
|
{
|
|
if (std::uncaught_exception())
|
|
LOG_ERROR(&Logger::get("StoragePtr"), "Maybe ignored drop table query because of uncaught exception.");
|
|
else
|
|
{
|
|
if (storage && storage->drop_on_destroy)
|
|
{
|
|
storage->dropImpl();
|
|
|
|
if (Poco::File(storage->path_to_remove_on_drop).exists())
|
|
Poco::File(storage->path_to_remove_on_drop).remove(true);
|
|
}
|
|
}
|
|
}
|
|
catch(...)
|
|
{
|
|
}
|
|
}
|
|
|
|
}
|