//@abi action
void testhand() {
gamecurrents gamecurrenttable(_self, _self);
auto existing = gamecurrenttable.find( _self );
if(existing == gamecurrenttable.end()) {
gamecurrenttable.emplace(_self,[&](auto& thisrow)
{
thisrow.account = _self;
thisrow.hand = 'a'; // DO NOT WORK
thisrow.version = 1;
});
}else{
eosio::print( "Edit here, ", hand );
gamecurrenttable.modify( existing, 0,[&](auto& thisrow){
thisrow.hand = ""; // WORK !!
thisrow.version = 2;
});
}
}
First I run the above action.
./cleos push action (myeosid) testhand '[]' -p (myeosid)
After than, I fetch the row
cleos get table (myeosid) (myeosid) gamecurrent
error occured
Error 3015013: Unpack data exception
Error Details:
Unable to unpack built-in type 'string' while processing 'gamecurrent.hand' read datastream of length 32 over by -4
But when I put "" data, it works. (when I run above test action again. it will update data by "")
"rows": [{
"account": (myeosid),
"price": "0.0000 SYS",
"version": 2,
"count": 0,
"hand": "",
"date": 0
}
],
"more": false
the struct is
/// @abi table gamecurrent i64
struct gamecurrent{
account_name account;
asset price;
uint8_t version;
string hand;
..
uint64_t primary_key() const { return account;}
EOSLIB_SERIALIZE(gamecurrent,(account)(price)(version)(hand)..)
};