当前位置: 首页>>代码示例>>C++>>正文


C++ pointer::setIsNew方法代码示例

本文整理汇总了C++中accountframe::pointer::setIsNew方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::setIsNew方法的具体用法?C++ pointer::setIsNew怎么用?C++ pointer::setIsNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在accountframe::pointer的用法示例。


在下文中一共展示了pointer::setIsNew方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getCachedEntry

AccountFrame::pointer
AccountFrame::loadAccount(AccountID const& accountID, Database& db)
{
    LedgerKey key;
    uint32_t sqlIsNew;
    key.type(ACCOUNT);
    key.account().accountID = accountID;
    if (cachedEntryExists(key, db))
    {
        auto p = getCachedEntry(key, db);
        return p ? std::make_shared<AccountFrame>(*p) : nullptr;
    }

    std::string actIDStrKey = PubKeyUtils::toStrKey(accountID);

    std::string publicKey, inflationDest, creditAuthKey;
    std::string homeDomain, thresholds;
    soci::indicator inflationDestInd;

    AccountFrame::pointer res = make_shared<AccountFrame>(accountID);
    AccountEntry& account = res->getAccount();
    CLOG(INFO, "Database") << "BEFORE getisnew is: " << res->getIsNew();
    auto prep =
        db.getPreparedStatement("SELECT "
"balance, seqnum, numsubentries, inflationdest, homedomain, thresholds, flags,lastmodified, 0 as isnew "
"FROM accounts WHERE accountid=:v1 "
"UNION SELECT "
"0 as balance, 0 as seqnum, 0 as numsubentries, null as inflationdest, '' as homedomain,'AQAAAA==' as thresholds,0 as flags,0 as lastmodified, 1 as isnew  "
"WHERE NOT EXISTS (SELECT * FROM accounts WHERE accountid=:v1)");
    auto& st = prep.statement();
    st.exchange(into(account.balance));
    st.exchange(into(account.seqNum));
    st.exchange(into(account.numSubEntries));
    st.exchange(into(inflationDest, inflationDestInd));
    st.exchange(into(homeDomain));
    st.exchange(into(thresholds));
    st.exchange(into(account.flags));
    st.exchange(into(res->getLastModified()));
    st.exchange(into(sqlIsNew));
    st.exchange(use(actIDStrKey, "v1"));
    st.define_and_bind();
    {
        auto timer = db.getSelectTimer("account");
        st.execute(true);
    }

    if (!st.got_data())
    {
        putCachedEntry(key, nullptr, db);
        return nullptr;
    }
    if (sqlIsNew == 1) {
        res->setIsNew();
    }
    CLOG(INFO, "Database") << actIDStrKey <<" sqlisnew is: " << sqlIsNew;
    CLOG(INFO, "Database") << actIDStrKey <<" isnew is: " << res->isnew;


    account.homeDomain = homeDomain;

    bn::decode_b64(thresholds.begin(), thresholds.end(),
                   res->mAccountEntry.thresholds.begin());

    if (inflationDestInd == soci::i_ok)
    {
        account.inflationDest.activate() =
            PubKeyUtils::fromStrKey(inflationDest);
    }

    account.signers.clear();

    if (account.numSubEntries != 0)
    {
        auto signers = loadSigners(db, actIDStrKey);
        account.signers.insert(account.signers.begin(), signers.begin(),
                               signers.end());
    }

    res->normalize();
    res->mUpdateSigners = false;
    assert(res->isValid());
    res->mKeyCalculated = false;
    res->putCachedEntry(db);
    return res;
}
开发者ID:buhrmi,项目名称:open-core-network,代码行数:85,代码来源:AccountFrame.cpp


注:本文中的accountframe::pointer::setIsNew方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。