mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-25 07:31:05 +00:00
be7ce4110e
This reverts commit e96515433d
.
40 lines
719 B
C++
40 lines
719 B
C++
// Remove large objects given on the command line from the default database.
|
|
#include <iostream>
|
|
|
|
#include "pqxx/pqxx"
|
|
|
|
|
|
int main(int, char *argv[])
|
|
{
|
|
pqxx::connection conn;
|
|
bool failures = false;
|
|
|
|
try
|
|
{
|
|
for (int i{1}; argv[i]; ++i)
|
|
{
|
|
auto o{pqxx::from_string<pqxx::oid>(argv[i])};
|
|
try
|
|
{
|
|
pqxx::perform([o, &conn] {
|
|
pqxx::work tx{conn};
|
|
pqxx::blob::remove(tx, o);
|
|
tx.commit();
|
|
});
|
|
}
|
|
catch (std::exception const &e)
|
|
{
|
|
std::cerr << e.what() << std::endl;
|
|
failures = true;
|
|
}
|
|
}
|
|
}
|
|
catch (std::exception const &e)
|
|
{
|
|
std::cerr << e.what() << std::endl;
|
|
return 2;
|
|
}
|
|
|
|
return failures;
|
|
}
|