Thanks for your answer,
1- I followed your instruction above but I have 2 errors I put them in comment
2- I have a "hashcompare" action but I don't know how I can compare the hash coming from the data base with the hash stored in the blockchain using uuid with this action.
This my full code
#include <eosio/eosio.hpp>
using namespace eosio;
class [[eosio::contract("blackbox")]] blackbox : public eosio::contract {
public:
blackbox(name receiver, name code, datastream<const char*> ds): contract(receiver, code, ds) {}
[[eosio::action]]
void add(const name user, uint64_t id, std::string uuid, std::string hash, std::string sqlrequest, std::string date){
require_auth( user );
blackboxdata_index addresses( get_self(), get_first_receiver().value );
std::replace( uuid.begin(), uuid.end(),'-',''); //15:50 error: expected expression
uuid = "Ox"+uuid;
uint128_t indexable_uuid = std::strtoul(uuid, 0, 16); //17:47: error: no viable conversion from 'std::string' (aka 'basic_string<char,char_traits<char>, allocator<char> >') to 'const char *'
addresses.emplace(user, [&]( auto& row ) {
row.user = user;
row.id = id;
row.uuid = indexable_uuid;
row.hash = hash;
row.sqlrequest =sqlrequest;
row.date = date;
});
}
[[eosio::action]]
void hashcompare (name user, std::string uuid_database, std::string hash_database){
require_auth (user)
blackboxdata_index addresses( get_self(), get_first_receiver().value );
//how I can compare the hash coming from the data base with the hash stored in the blockchain using uuid with this action.
}
private:
struct [[eosio::table]] blackboxdata {
name user;
uint64_t id;
uint128_t uuid;
std::string hash;
std::string sqlrequest;
std::string date;
uint64_t primary_key() const { return id;}
uint128_t secondary_key() const { return uuid;}
};
typedef eosio::multi_index<"data"_n, blackboxdata,
indexed_by<"hash"_n, const_mem_fun<blackboxdata, uint128_t, &blackboxdata::secondary_key> > >blackboxdata_index;
};