数据库中只保留最新的100条记录,旧纪录删除
// 最多100条
besthistory_tables besthistory_table(_self, _self.value);
total_count = 0;
auto itr_besthistory = besthistory_table.rbegin();
while(itr_besthistory != besthistory_table.rend()){
if(total_count >= 99){
auto itr = besthistory_table.erase(--itr_besthistory.base());
itr_besthistory = std::reverse_iterator(itr);
} else {
total_count++;
itr_besthistory++;
}
}
版权属于:区块链开发网
本文链接:www.zhugexiaojue.com/index.php/archives/892.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!
,
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
喜欢就支持一下吧