Skip to main content
Add code block, text and code
Source Link
tmm
  • 2.1k
  • 1
  • 15
  • 35

I created a table with 5 rows/records. While just playing with the code, II tried to print the whole table content with with the following code:

require_auth(_self);
accounts_table accounts(_self, _self.value);
for(auto itr = accounts.begin(); itr != accounts.end();++itr) {
   print( itr->parent_account);
   print("\n");
}

But only got one row.

When iI call the command cleos -u get table ACCOUNT SCOPE TABLENAMEcleos -u get table ACCOUNT SCOPE TABLENAME, it shows all the 5 records.

Why does the code above only prints the first record?

I created a table with 5 rows/records While just playing with the code, I tried to print the whole table content with the following code

require_auth(_self);
accounts_table accounts(_self, _self.value);
for(auto itr = accounts.begin(); itr != accounts.end();++itr) {
   print( itr->parent_account);
   print("\n");
}

But only got one row.

When i call the command cleos -u get table ACCOUNT SCOPE TABLENAME, it shows all the 5 records.

Why does the code above only prints the first record?

I created a table with 5 rows/records. I tried to print the whole table content with the following code:

require_auth(_self);
accounts_table accounts(_self, _self.value);
for(auto itr = accounts.begin(); itr != accounts.end();++itr) {
   print( itr->parent_account);
   print("\n");
}

But only got one row.

When I call the command cleos -u get table ACCOUNT SCOPE TABLENAME, it shows all the 5 records.

Why does the code above only prints the first record?

i createI created a table with 5 rows/records justWhile just playing with the code i, I tried to print the whole table content with the followfollowing code: require_auth(_self); accounts_table accounts(_self, _self.value); for(auto itr = accounts.begin(); itr != accounts.end();++itr) { print( itr->parent_account); print("\n"); }

require_auth(_self);
accounts_table accounts(_self, _self.value);
for(auto itr = accounts.begin(); itr != accounts.end();++itr) {
   print( itr->parent_account);
   print("\n");
}

butBut only getgot one row when.

When i call the command cleos -u get table ACCTACCOUNT SCOPE TABLENAME it, it shows all the 5 records why.

Why does the code show above only prints the first record  ?

i create a table with 5 rows/records just playing with the code i tried to print the whole table content with the follow code: require_auth(_self); accounts_table accounts(_self, _self.value); for(auto itr = accounts.begin(); itr != accounts.end();++itr) { print( itr->parent_account); print("\n"); }

but only get one row when i call the command cleos -u get table ACCT SCOPE TABLENAME it shows the 5 records why the code show above only prints the first record  ?

I created a table with 5 rows/records While just playing with the code, I tried to print the whole table content with the following code

require_auth(_self);
accounts_table accounts(_self, _self.value);
for(auto itr = accounts.begin(); itr != accounts.end();++itr) {
   print( itr->parent_account);
   print("\n");
}

But only got one row.

When i call the command cleos -u get table ACCOUNT SCOPE TABLENAME, it shows all the 5 records.

Why does the code above only prints the first record?

Source Link

why it prints only one "record/row"?

i create a table with 5 rows/records just playing with the code i tried to print the whole table content with the follow code: require_auth(_self); accounts_table accounts(_self, _self.value); for(auto itr = accounts.begin(); itr != accounts.end();++itr) { print( itr->parent_account); print("\n"); }

but only get one row when i call the command cleos -u get table ACCT SCOPE TABLENAME it shows the 5 records why the code show above only prints the first record ?