Fix transaction load/save functions.

This commit is contained in:
JoelKatz
2012-06-10 16:15:33 -07:00
parent 913b86c410
commit 63ea3d6f22
3 changed files with 5 additions and 2 deletions

View File

@@ -294,7 +294,7 @@ void Ledger::saveAcceptedLedger(Ledger::pointer ledger)
Log(lsTRACE) << "ActTx: " << sql;
db->executeSQL(sql);
db->executeSQL(txn.getSQLInsertHeader() + txn.getSQL(ledger->getLedgerSeq(), TXN_SQL_VALIDATED) + ";");
// FIXME: If above updates no rows, modify seq/status
// FIXME: If above updates no rows, modify seq/status (upsert)
}
db->executeSQL("COMMIT TRANSACTION;");
}

View File

@@ -14,6 +14,8 @@
#define TXN_SQL_CONFLICT 'C'
#define TXN_SQL_HELD 'H'
#define TXN_SQL_VALIDATED 'V'
#define TXN_SQL_INCLUDED 'I'
#define TXN_SQL_UNKNOWN 'U'
class SerializedTransaction : public SerializedType
{

View File

@@ -248,10 +248,11 @@ public:
void setStatus(TransStatus status, uint32 ledgerSeq);
void setStatus(TransStatus status) { mStatus=status; }
void setLedger(uint32 ledger) { mInLedger = ledger; }
// database functions
static void saveTransaction(Transaction::pointer);
bool save() const;
bool save();
static Transaction::pointer load(const uint256& id);
static Transaction::pointer findFrom(const NewcoinAddress& fromID, uint32 seq);