mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Remove unused database table (RIPD-755)
This commit is contained in:
@@ -106,19 +106,6 @@ const char* LedgerDBInit[] =
|
||||
|
||||
int LedgerDBCount = std::extent<decltype(LedgerDBInit)>::value;
|
||||
|
||||
// RPC database holds persistent data for RPC clients.
|
||||
const char* RpcDBInit[] =
|
||||
{
|
||||
|
||||
// Local persistence of the RPC client
|
||||
"CREATE TABLE IF NOT EXISTS RPCData ( \
|
||||
Key TEXT PRIMARY Key, \
|
||||
Value TEXT \
|
||||
);",
|
||||
};
|
||||
|
||||
int RpcDBCount = std::extent<decltype(RpcDBInit)>::value;
|
||||
|
||||
// NodeIdentity database holds local accounts and trusted nodes
|
||||
// VFALCO NOTE but its a table not a database, so...?
|
||||
//
|
||||
|
||||
@@ -23,13 +23,11 @@
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO TODO Tidy these up into a class with functions and return types.
|
||||
extern const char* RpcDBInit[];
|
||||
extern const char* TxnDBInit[];
|
||||
extern const char* LedgerDBInit[];
|
||||
extern const char* WalletDBInit[];
|
||||
|
||||
// VFALCO TODO Figure out what these counts are for
|
||||
extern int RpcDBCount;
|
||||
extern int TxnDBCount;
|
||||
extern int LedgerDBCount;
|
||||
extern int WalletDBCount;
|
||||
|
||||
@@ -289,7 +289,6 @@ public:
|
||||
beast::DeadlineTimer m_sweepTimer;
|
||||
beast::DeadlineTimer m_entropyTimer;
|
||||
|
||||
std::unique_ptr <DatabaseCon> mRpcDB;
|
||||
std::unique_ptr <DatabaseCon> mTxnDB;
|
||||
std::unique_ptr <DatabaseCon> mLedgerDB;
|
||||
std::unique_ptr <DatabaseCon> mWalletDB;
|
||||
@@ -607,11 +606,6 @@ public:
|
||||
return m_sntpClient->getOffset (offset);
|
||||
}
|
||||
|
||||
DatabaseCon& getRpcDB ()
|
||||
{
|
||||
assert (mRpcDB.get() != nullptr);
|
||||
return *mRpcDB;
|
||||
}
|
||||
DatabaseCon& getTxnDB ()
|
||||
{
|
||||
assert (mTxnDB.get() != nullptr);
|
||||
@@ -637,14 +631,11 @@ public:
|
||||
//--------------------------------------------------------------------------
|
||||
bool initSqliteDbs ()
|
||||
{
|
||||
assert (mRpcDB.get () == nullptr);
|
||||
assert (mTxnDB.get () == nullptr);
|
||||
assert (mLedgerDB.get () == nullptr);
|
||||
assert (mWalletDB.get () == nullptr);
|
||||
|
||||
DatabaseCon::Setup setup = setup_DatabaseCon (getConfig());
|
||||
mRpcDB = std::make_unique <DatabaseCon> (setup, "rpc.db", RpcDBInit,
|
||||
RpcDBCount);
|
||||
mTxnDB = std::make_unique <DatabaseCon> (setup, "transaction.db",
|
||||
TxnDBInit, TxnDBCount);
|
||||
mLedgerDB = std::make_unique <DatabaseCon> (setup, "ledger.db",
|
||||
@@ -653,7 +644,6 @@ public:
|
||||
WalletDBInit, WalletDBCount);
|
||||
|
||||
return
|
||||
mRpcDB.get() != nullptr &&
|
||||
mTxnDB.get () != nullptr &&
|
||||
mLedgerDB.get () != nullptr &&
|
||||
mWalletDB.get () != nullptr;
|
||||
|
||||
@@ -115,7 +115,6 @@ public:
|
||||
virtual PathRequests& getPathRequests () = 0;
|
||||
virtual SHAMapStore& getSHAMapStore () = 0;
|
||||
|
||||
virtual DatabaseCon& getRpcDB () = 0;
|
||||
virtual DatabaseCon& getTxnDB () = 0;
|
||||
virtual DatabaseCon& getLedgerDB () = 0;
|
||||
|
||||
|
||||
@@ -116,44 +116,4 @@ bool LocalCredentials::nodeIdentityCreate ()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LocalCredentials::dataDelete (std::string const& strKey)
|
||||
{
|
||||
auto db = getApp().getRpcDB ().checkoutDb ();
|
||||
|
||||
*db << (str (boost::format ("DELETE FROM RPCData WHERE Key=%s;")
|
||||
% sqlEscape (strKey)));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LocalCredentials::dataFetch (std::string const& strKey, std::string& strValue)
|
||||
{
|
||||
auto db = getApp().getRpcDB ().checkoutDb ();
|
||||
|
||||
bool bSuccess = false;
|
||||
|
||||
soci::blob value (*db);
|
||||
soci::indicator vi;
|
||||
*db << str (boost::format ("SELECT Value FROM RPCData WHERE Key=%s;")
|
||||
% sqlEscape (strKey)),
|
||||
soci::into(value, vi);
|
||||
|
||||
if (soci::i_ok == vi)
|
||||
{
|
||||
convert (value, strValue);
|
||||
bSuccess = true;
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool LocalCredentials::dataStore (std::string const& strKey, std::string const& strValue)
|
||||
{
|
||||
auto db = getApp().getRpcDB ().checkoutDb ();
|
||||
|
||||
*db << (str (boost::format ("REPLACE INTO RPCData (Key, Value) VALUES (%s,%s);")
|
||||
% sqlEscape (strKey)
|
||||
% sqlEscape (strValue)));
|
||||
return true;
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -48,13 +48,6 @@ public:
|
||||
return mNodePrivateKey;
|
||||
}
|
||||
|
||||
// Local persistence of RPC clients
|
||||
bool dataDelete (std::string const& strKey);
|
||||
|
||||
// VFALCO NOTE why is strValue non-const?
|
||||
bool dataFetch (std::string const& strKey, std::string& strValue);
|
||||
bool dataStore (std::string const& strKey, std::string const& strValue);
|
||||
|
||||
private:
|
||||
bool nodeIdentityLoad ();
|
||||
bool nodeIdentityCreate ();
|
||||
|
||||
Reference in New Issue
Block a user