Cosmetic SQL clean up.

This commit is contained in:
Arthur Britto
2012-05-07 18:39:19 -07:00
parent 2fad636ed2
commit 0492ea5877
16 changed files with 34 additions and 26 deletions

View File

@@ -64,7 +64,7 @@ bool HashedObject::store(HashedObjectType type, uint32 index, const std::vector<
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
Database* db=theApp->getHashNodeDB()->getDB();
return db->executeSQL(sql.c_str());
return db->executeSQL(sql);
}
bool HashedObject::store() const
@@ -91,7 +91,7 @@ HashedObject::pointer HashedObject::retrieve(const uint256& hash)
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
Database* db=theApp->getHashNodeDB()->getDB();
if(!db->executeSQL(sql.c_str()) || !db->startIterRows())
if(!db->executeSQL(sql) || !db->startIterRows())
return HashedObject::pointer();
std::string type;

View File

@@ -248,7 +248,7 @@ void Ledger::saveAcceptedLedger(Ledger::pointer ledger)
sql.append("');");
ScopedLock sl(theApp->getLedgerDB()->getDBLock());
theApp->getLedgerDB()->getDB()->executeSQL(sql.c_str());
theApp->getLedgerDB()->getDB()->executeSQL(sql);
// write out dirty nodes
while(ledger->mTransactionMap->flushDirty(64, TRANSACTION_NODE, ledger->mLedgerSeq))

View File

@@ -69,3 +69,4 @@ public:
};
#endif
// vim:ts=4

View File

@@ -21,3 +21,4 @@ struct LedgerEntryFormat
extern LedgerEntryFormat LedgerFormats[];
extern LedgerEntryFormat* getLgrFormat(LedgerEntryType t);
#endif
// vim:ts=4

View File

@@ -84,3 +84,4 @@ Ledger::pointer LedgerHistory::canonicalizeLedger(Ledger::pointer ledger, bool s
if(ledger->isAccepted()) mLedgersByIndex[ledger->getLedgerSeq()]=ledger;
return ledger;
}
// vim:ts=4

View File

@@ -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));
return base;
}
// vim:ts=4

View File

@@ -67,3 +67,4 @@ public:
};
#endif
// vim:ts=4

View File

@@ -109,3 +109,4 @@ SerializedLedgerEntry::pointer Ledger::getNickname(LedgerStateParms& parms, cons
return SerializedLedgerEntry::pointer();
}
}
// vim:ts=4

View File

@@ -23,7 +23,7 @@ CKey::pointer PubKeyCache::locate(const NewcoinAddress& id)
{ // is it in the database
ScopedLock sl(theApp->getTxnDB()->getDBLock());
Database* db=theApp->getTxnDB()->getDB();
if(!db->executeSQL(sql.c_str()) || !db->startIterRows())
if(!db->executeSQL(sql) || !db->startIterRows())
return CKey::pointer();
pkSize=db->getBinary("PubKey", &(data.front()), data.size());
db->endIterRows();
@@ -63,7 +63,7 @@ CKey::pointer PubKeyCache::store(const NewcoinAddress& id, CKey::pointer key)
sql.append(");");
ScopedLock dbl(theApp->getTxnDB()->getDBLock());
theApp->getTxnDB()->getDB()->executeSQL(sql.c_str(), true);
theApp->getTxnDB()->getDB()->executeSQL(sql, true);
return key;
}

View File

@@ -675,4 +675,4 @@ bool SHAMap::TestSHAMap()
return false;
return true;
}
// vim:ts=4

View File

@@ -327,3 +327,4 @@ public:
};
#endif
// vim:ts=4

View File

@@ -368,3 +368,4 @@ const uint256& SHAMapTreeNode::getChildHash(int m) const
assert( (m>=0) && (m<16) && (mType==tnINNER) );
return mHashes[m];
}
// vim:ts=4

View File

@@ -228,7 +228,7 @@ bool Transaction::save() const
ScopedLock sl(theApp->getTxnDB()->getDBLock());
Database* db = theApp->getTxnDB()->getDB();
return db->executeSQL(sql.c_str());
return db->executeSQL(sql);
}
Transaction::pointer Transaction::transactionFromSQL(const std::string& sql)

View File

@@ -39,7 +39,7 @@ void ValidationCollection::addToDB(newcoin::Validation& valid,int weCare)
db->escape(hanko.begin(),hanko.GetSerializeSize(),hankoStr);
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);
db->executeSQL(sql.c_str());
db->executeSQL(sql);
}

View File

@@ -190,7 +190,7 @@ LocalAccountFamily::pointer LocalAccountFamily::readFamily(const NewcoinAddress&
ScopedLock sl(theApp->getWalletDB()->getDBLock());
Database *db=theApp->getWalletDB()->getDB();
if(!db->executeSQL(sql.c_str()) || !db->startIterRows())
if(!db->executeSQL(sql) || !db->startIterRows())
return LocalAccountFamily::pointer();
db->getStr("Comment", comment);
@@ -223,7 +223,7 @@ void LocalAccountFamily::write(bool is_new)
sql.append(");");
ScopedLock sl(theApp->getWalletDB()->getDBLock());
theApp->getWalletDB()->getDB()->executeSQL(sql.c_str());
theApp->getWalletDB()->getDB()->executeSQL(sql);
}
std::string LocalAccountFamily::getSQLFields()
@@ -446,7 +446,7 @@ void Wallet::load()
ScopedLock sl(theApp->getWalletDB()->getDBLock());
Database *db=theApp->getWalletDB()->getDB();
if(!db->executeSQL(sql.c_str()))
if(!db->executeSQL(sql))
{
#ifdef DEBUG
std::cerr << "Unable to load wallet" << std::endl;