本文整理汇总了C++中transaction::pointer::setLedger方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::setLedger方法的具体用法?C++ pointer::setLedger怎么用?C++ pointer::setLedger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transaction::pointer
的用法示例。
在下文中一共展示了pointer::setLedger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transactionFromSQL
Transaction::pointer Transaction::transactionFromSQL (Database* db, bool bValidate)
{
Serializer rawTxn;
std::string status;
uint32 inLedger;
int txSize = 2048;
rawTxn.resize (txSize);
db->getStr ("Status", status);
inLedger = db->getInt ("LedgerSeq");
txSize = db->getBinary ("RawTxn", &*rawTxn.begin (), rawTxn.getLength ());
if (txSize > rawTxn.getLength ())
{
rawTxn.resize (txSize);
db->getBinary ("RawTxn", &*rawTxn.begin (), rawTxn.getLength ());
}
rawTxn.resize (txSize);
SerializerIterator it (rawTxn);
SerializedTransaction::pointer txn = boost::make_shared<SerializedTransaction> (boost::ref (it));
Transaction::pointer tr = boost::make_shared<Transaction> (txn, bValidate);
TransStatus st (INVALID);
switch (status[0])
{
case TXN_SQL_NEW:
st = NEW;
break;
case TXN_SQL_CONFLICT:
st = CONFLICTED;
break;
case TXN_SQL_HELD:
st = HELD;
break;
case TXN_SQL_VALIDATED:
st = COMMITTED;
break;
case TXN_SQL_INCLUDED:
st = INCLUDED;
break;
case TXN_SQL_UNKNOWN:
break;
default:
assert (false);
}
tr->setStatus (st);
tr->setLedger (inLedger);
return tr;
}
示例2: transactionFromSQL
// DAVID: would you rather duplicate this code or keep the lock longer?
Transaction::pointer Transaction::transactionFromSQL(const std::string& sql)
{
Serializer rawTxn;
std::string status;
uint32 inLedger;
int txSize = 2048;
rawTxn.resize(txSize);
{
ScopedLock sl(theApp->getTxnDB()->getDBLock());
Database* db = theApp->getTxnDB()->getDB();
if (!db->executeSQL(sql, true) || !db->startIterRows())
return Transaction::pointer();
db->getStr("Status", status);
inLedger = db->getInt("LedgerSeq");
txSize = db->getBinary("RawTxn", &*rawTxn.begin(), rawTxn.getLength());
if (txSize > rawTxn.getLength())
{
rawTxn.resize(txSize);
db->getBinary("RawTxn", &*rawTxn.begin(), rawTxn.getLength());
}
db->endIterRows();
}
rawTxn.resize(txSize);
SerializerIterator it(rawTxn);
SerializedTransaction::pointer txn = boost::make_shared<SerializedTransaction>(boost::ref(it));
Transaction::pointer tr = boost::make_shared<Transaction>(txn, true);
TransStatus st(INVALID);
switch (status[0])
{
case TXN_SQL_NEW: st = NEW; break;
case TXN_SQL_CONFLICT: st = CONFLICTED; break;
case TXN_SQL_HELD: st = HELD; break;
case TXN_SQL_VALIDATED: st = COMMITTED; break;
case TXN_SQL_INCLUDED: st = INCLUDED; break;
case TXN_SQL_UNKNOWN: break;
default: assert(false);
}
tr->setStatus(st);
tr->setLedger(inLedger);
return tr;
}