I want to develop a contract and save data by using emplace function. Below is my code:
offer_bets_index offerbets(_self, player);
eosio::print("begin to write db\n");
auto bets_itr = offerbets.emplace(_self, [&](auto& offerbet) {
eosio::print("new offer bet");
uint64_t id = offerbets.available_primary_key();
eosio::print("new available key:", id);
offerbet.id = id;
offerbet.player = player;
offerbet.draw = draw;
offerbet.bet = bet;
offerbet.buycnt = buycnt;
offerbet.buylottos = buylottos;
offerbet.buytime = buytime;
});
eosio::print("end write", bets_itr->id);
Only the first eosio::print
content show correctly, but the print content inside the lambda function and the last print content didn't show.
Seems like the emplace function didn't been executed in the action?
Anybody knows why?? Thanks!