eos icon indicating copy to clipboard operation
eos copied to clipboard

Get table rows does not work with multindex account_name

Open filipniziol opened this issue 8 years ago • 2 comments

The rows are not shown when I use account_name column to store as key of multiindex. The transaction is executed, but when running get table from cleos or get_table_rows from http api it returns no rows

// @abi table
		struct psase {
			uint64_t purchaser;
			asset irespobought;
			asset eospaid;

			uint64_t primary_key() const { return purchaser; }

			EOSLIB_SERIALIZE(psase, (purchaser)(irespobought)(eospaid))
		};

typedef multi_index<N(psase), psase> psases;

void irespoicoico::addpurchase(account_name purchaser, asset irespobought, asset eospaid)
	{
		psases p(_self, _self);

		auto iter = p.find(purchaser);


		if (iter == p.end()) {

			p.emplace(configs(_self, _self).get().application, [&](auto& row) {
				row.purchaser = purchaser;
				row.irespobought = irespobought;
				row.eospaid = eospaid;
			});
		}
		else {
			p.modify(iter, configs(_self, _self).get().application, [&](auto& row) {
				row.irespobought = irespobought;
				row.eospaid = eospaid;
			});
		}
	}

filipniziol avatar Aug 02 '18 10:08 filipniziol

Can you provide your get table command with parameters?

taokayan avatar Aug 03 '18 01:08 taokayan

Sorry. It works. Fogot to add method to EOSIO_API

filipniziol avatar Aug 03 '18 16:08 filipniziol