-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Saving Table with FixedString32 #475
Comments
Can you change the value in the table? |
Yes, if you look at the build.sh script it sets the value but then I cannot read it back out (maybe just my lack of c++ skills), the eosc command still asserts so I cannot verify that anything was written |
maybe type char, doesn't work.
Output in eosd windowMaybe. At you too she will be. |
Yes I get that error every time a message is sent but it doesnt seem to break anything |
The get_recent_transaction is issue #429. |
@michaeljyeates can you attach your implementation so that I can debug? Edit: Just saw your attachment. |
Can you modify your abi file as below and check again please? I changed the keyname in table section from "teststring" to "owner". I will continue debugging it tomorrow.
|
I tried changing that, same problem |
Is there a way to delete the database or remove all entries? |
You can remove the data-dir folder and start eosd again
…On Sep 20, 2017 15:39, "michaeljyeates" ***@***.***> wrote:
Is there a way to delete the database or remove all entries?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#475 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAOUotkjtpILHPEbzWJJEaDiWB-GdtsOks5skVv1gaJpZM4Pcf9h>
.
|
After some debugging here is a quick fix for your contract. In dbtest.abi "keynames" : ["owner"], That change is needed to later query the tables using ./eosc get table dbtest dbtest test In dbtest.hpp struct PACKED(TestString) {
AccountName owner;
char name[33];
};
static_assert( sizeof(TestString) == sizeof(uint64_t)+33, "unexpected packing" ); since the first byte of a serialized FixedString32 indicates its length. Also in dbtest.hpp the call to Tests::get( owner, teststr ); otherwise you will be calling static bool get( Record& r, uint64_t s = scope ) {
return impl::load_primary( s, code, table, &r, sizeof(Record) ) == sizeof(Record);
} and a And finally in dbtest.cpp print("Store string", (const char *)(teststr.name+1), "\n");
...
print("GOT teststring", (const char *)(teststr_row.name+1), "\n"); Note: This is a quick fix to make your contract work, in future versions the handling of types like FixedString32 inside the contract code will be easier. |
Here is the output from {
"rows": [{
"owner": "dbtest",
"name": "0123456789ABCDEF0123456789ABCDEF"
},{
"owner": "iiii",
"name": "0123456789ABCDEF0123456789ABCDEF"
},{
"owner": "xx",
"name": "0123456789ABCDEF0123456789ABCDEF"
},{
"owner": "yy",
"name": "0123456789ABCDEF0123456789ABCDEF"
}
],
"more": false
} |
I am getting this error now
Attached is my current version |
Are you using PACKED when declaring TestString? struct PACKED(TestString) {
AccountName owner;
char name[33];
}; |
That worked, thanks! |
thanks this post.
} |
This CLI11 update from v1.9.0 to v1.9.1 provides the following improvements: - Support relative inclusion [#475](CLIUtils/CLI11#475) - Fix cases where spaces in paths could break CMake support [#471](CLIUtils/CLI11#471) - Fix an issue with string conversion [#421](CLIUtils/CLI11#421) - Cross-compiling improvement for Conan.io [#430](CLIUtils/CLI11#430) - Fix option group default propagation [#450](CLIUtils/CLI11#450) - Fix for C++20 [#459](CLIUtils/CLI11#459) - Support compiling with RTTI off [#461](CLIUtils/CLI11#461)
This CLI11 update from v1.9.0 to v1.9.1 provides the following improvements: - Support relative inclusion [#475](CLIUtils/CLI11#475) - Fix cases where spaces in paths could break CMake support [#471](CLIUtils/CLI11#471) - Fix an issue with string conversion [#421](CLIUtils/CLI11#421) - Cross-compiling improvement for Conan.io [#430](CLIUtils/CLI11#430) - Fix option group default propagation [#450](CLIUtils/CLI11#450) - Fix for C++20 [#459](CLIUtils/CLI11#459) - Support compiling with RTTI off [#461](CLIUtils/CLI11#461)
I am writing a simple test contract which saves a struct with (Name,char[32]). Saving seems to work ok but when I try to read nothing is returned and
eosc get table dbtest dbtest test
fails with the following error. Attached is a simple test case, I think the length of 40 is correct so I am not sure why it has a negative over figuredbtest.zip
The text was updated successfully, but these errors were encountered: