mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Cosmetic SQL clean up.
This commit is contained in:
@@ -64,7 +64,7 @@ bool HashedObject::store(HashedObjectType type, uint32 index, const std::vector<
|
|||||||
|
|
||||||
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
|
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
|
||||||
Database* db=theApp->getHashNodeDB()->getDB();
|
Database* db=theApp->getHashNodeDB()->getDB();
|
||||||
return db->executeSQL(sql.c_str());
|
return db->executeSQL(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HashedObject::store() const
|
bool HashedObject::store() const
|
||||||
@@ -91,7 +91,7 @@ HashedObject::pointer HashedObject::retrieve(const uint256& hash)
|
|||||||
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
|
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
|
||||||
Database* db=theApp->getHashNodeDB()->getDB();
|
Database* db=theApp->getHashNodeDB()->getDB();
|
||||||
|
|
||||||
if(!db->executeSQL(sql.c_str()) || !db->startIterRows())
|
if(!db->executeSQL(sql) || !db->startIterRows())
|
||||||
return HashedObject::pointer();
|
return HashedObject::pointer();
|
||||||
|
|
||||||
std::string type;
|
std::string type;
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ void Ledger::saveAcceptedLedger(Ledger::pointer ledger)
|
|||||||
sql.append("');");
|
sql.append("');");
|
||||||
|
|
||||||
ScopedLock sl(theApp->getLedgerDB()->getDBLock());
|
ScopedLock sl(theApp->getLedgerDB()->getDBLock());
|
||||||
theApp->getLedgerDB()->getDB()->executeSQL(sql.c_str());
|
theApp->getLedgerDB()->getDB()->executeSQL(sql);
|
||||||
|
|
||||||
// write out dirty nodes
|
// write out dirty nodes
|
||||||
while(ledger->mTransactionMap->flushDirty(64, TRANSACTION_NODE, ledger->mLedgerSeq))
|
while(ledger->mTransactionMap->flushDirty(64, TRANSACTION_NODE, ledger->mLedgerSeq))
|
||||||
|
|||||||
@@ -69,3 +69,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -21,3 +21,4 @@ struct LedgerEntryFormat
|
|||||||
extern LedgerEntryFormat LedgerFormats[];
|
extern LedgerEntryFormat LedgerFormats[];
|
||||||
extern LedgerEntryFormat* getLgrFormat(LedgerEntryType t);
|
extern LedgerEntryFormat* getLgrFormat(LedgerEntryType t);
|
||||||
#endif
|
#endif
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -84,3 +84,4 @@ Ledger::pointer LedgerHistory::canonicalizeLedger(Ledger::pointer ledger, bool s
|
|||||||
if(ledger->isAccepted()) mLedgersByIndex[ledger->getLedgerSeq()]=ledger;
|
if(ledger->isAccepted()) mLedgersByIndex[ledger->getLedgerSeq()]=ledger;
|
||||||
return ledger;
|
return ledger;
|
||||||
}
|
}
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -14,3 +14,4 @@ uint256 Ledger::getRippleIndex(const uint160& accountID, const uint160& extendTo
|
|||||||
memcpy(base.begin() + (160/8), (accountID^currency).begin(), (256/8)-(160/8));
|
memcpy(base.begin() + (160/8), (accountID^currency).begin(), (256/8)-(160/8));
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -67,3 +67,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -109,3 +109,4 @@ SerializedLedgerEntry::pointer Ledger::getNickname(LedgerStateParms& parms, cons
|
|||||||
return SerializedLedgerEntry::pointer();
|
return SerializedLedgerEntry::pointer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ CKey::pointer PubKeyCache::locate(const NewcoinAddress& id)
|
|||||||
{ // is it in the database
|
{ // is it in the database
|
||||||
ScopedLock sl(theApp->getTxnDB()->getDBLock());
|
ScopedLock sl(theApp->getTxnDB()->getDBLock());
|
||||||
Database* db=theApp->getTxnDB()->getDB();
|
Database* db=theApp->getTxnDB()->getDB();
|
||||||
if(!db->executeSQL(sql.c_str()) || !db->startIterRows())
|
if(!db->executeSQL(sql) || !db->startIterRows())
|
||||||
return CKey::pointer();
|
return CKey::pointer();
|
||||||
pkSize=db->getBinary("PubKey", &(data.front()), data.size());
|
pkSize=db->getBinary("PubKey", &(data.front()), data.size());
|
||||||
db->endIterRows();
|
db->endIterRows();
|
||||||
@@ -63,7 +63,7 @@ CKey::pointer PubKeyCache::store(const NewcoinAddress& id, CKey::pointer key)
|
|||||||
sql.append(");");
|
sql.append(");");
|
||||||
|
|
||||||
ScopedLock dbl(theApp->getTxnDB()->getDBLock());
|
ScopedLock dbl(theApp->getTxnDB()->getDBLock());
|
||||||
theApp->getTxnDB()->getDB()->executeSQL(sql.c_str(), true);
|
theApp->getTxnDB()->getDB()->executeSQL(sql, true);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -675,4 +675,4 @@ bool SHAMap::TestSHAMap()
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -327,3 +327,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -368,3 +368,4 @@ const uint256& SHAMapTreeNode::getChildHash(int m) const
|
|||||||
assert( (m>=0) && (m<16) && (mType==tnINNER) );
|
assert( (m>=0) && (m<16) && (mType==tnINNER) );
|
||||||
return mHashes[m];
|
return mHashes[m];
|
||||||
}
|
}
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ bool Transaction::save() const
|
|||||||
|
|
||||||
ScopedLock sl(theApp->getTxnDB()->getDBLock());
|
ScopedLock sl(theApp->getTxnDB()->getDBLock());
|
||||||
Database* db = theApp->getTxnDB()->getDB();
|
Database* db = theApp->getTxnDB()->getDB();
|
||||||
return db->executeSQL(sql.c_str());
|
return db->executeSQL(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transaction::pointer Transaction::transactionFromSQL(const std::string& sql)
|
Transaction::pointer Transaction::transactionFromSQL(const std::string& sql)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ void ValidationCollection::addToDB(newcoin::Validation& valid,int weCare)
|
|||||||
db->escape(hanko.begin(),hanko.GetSerializeSize(),hankoStr);
|
db->escape(hanko.begin(),hanko.GetSerializeSize(),hankoStr);
|
||||||
db->escape(sig.begin(),sig.GetSerializeSize(),sigStr);
|
db->escape(sig.begin(),sig.GetSerializeSize(),sigStr);
|
||||||
string sql=strprintf("INSERT INTO Validations (LedgerIndex,Hash,Hanko,SeqNum,Sig,WeCare) values (%d,%s,%s,%d,%s,%d)",valid.ledgerindex(),hashStr.c_str(),hankoStr.c_str(),valid.seqnum(),sigStr.c_str(),weCare);
|
string sql=strprintf("INSERT INTO Validations (LedgerIndex,Hash,Hanko,SeqNum,Sig,WeCare) values (%d,%s,%s,%d,%s,%d)",valid.ledgerindex(),hashStr.c_str(),hankoStr.c_str(),valid.seqnum(),sigStr.c_str(),weCare);
|
||||||
db->executeSQL(sql.c_str());
|
db->executeSQL(sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ LocalAccountFamily::pointer LocalAccountFamily::readFamily(const NewcoinAddress&
|
|||||||
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
||||||
Database *db=theApp->getWalletDB()->getDB();
|
Database *db=theApp->getWalletDB()->getDB();
|
||||||
|
|
||||||
if(!db->executeSQL(sql.c_str()) || !db->startIterRows())
|
if(!db->executeSQL(sql) || !db->startIterRows())
|
||||||
return LocalAccountFamily::pointer();
|
return LocalAccountFamily::pointer();
|
||||||
|
|
||||||
db->getStr("Comment", comment);
|
db->getStr("Comment", comment);
|
||||||
@@ -223,7 +223,7 @@ void LocalAccountFamily::write(bool is_new)
|
|||||||
sql.append(");");
|
sql.append(");");
|
||||||
|
|
||||||
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
||||||
theApp->getWalletDB()->getDB()->executeSQL(sql.c_str());
|
theApp->getWalletDB()->getDB()->executeSQL(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LocalAccountFamily::getSQLFields()
|
std::string LocalAccountFamily::getSQLFields()
|
||||||
@@ -446,7 +446,7 @@ void Wallet::load()
|
|||||||
|
|
||||||
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
||||||
Database *db=theApp->getWalletDB()->getDB();
|
Database *db=theApp->getWalletDB()->getDB();
|
||||||
if(!db->executeSQL(sql.c_str()))
|
if(!db->executeSQL(sql))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr << "Unable to load wallet" << std::endl;
|
std::cerr << "Unable to load wallet" << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user