Fix SQL for tracking Misc information.

This commit is contained in:
Arthur Britto
2012-04-24 16:33:18 -07:00
parent 7f6457ae77
commit 5f31b13e8d
2 changed files with 5 additions and 2 deletions

View File

@@ -65,8 +65,11 @@ const char *WalletDBInit[] = {
);",
// Miscellaneous persistent information
// Integer: 1 : Used to simplify SQL.
// ScoreUpdated: when scores was last updated.
// FetchUpdated: when last fetch succeeded.
"CREATE TABLE Misc ( \
Magic INTEGER UNIQUE NOT NULL, \
ScoreUpdated DATETIME, \
FetchUpdated DATETIME \
);",

View File

@@ -56,7 +56,7 @@ bool UniqueNodeList::miscLoad()
ScopedLock sl(theApp->getWalletDB()->getDBLock());
Database *db=theApp->getWalletDB()->getDB();
if (!db->executeSQL("SELECT * FROM Misc;")) return false;
if (!db->executeSQL("SELECT * FROM Misc WHERE Magic=1;")) return false;
bool bAvail = !!db->startIterRows();
@@ -73,7 +73,7 @@ bool UniqueNodeList::miscSave()
Database* db=theApp->getWalletDB()->getDB();
ScopedLock sl(theApp->getWalletDB()->getDBLock());
db->executeSQL(str(boost::format("REPLACE INTO Misc (FetchUpdated,ScoreUpdated) VALUES (%d,%d);")
db->executeSQL(str(boost::format("REPLACE INTO Misc (Magic,FetchUpdated,ScoreUpdated) VALUES (1,%d,%d);")
% iToSeconds(mtpFetchUpdated)
% iToSeconds(mtpScoreUpdated)));