db_lookup_local

Function db_lookup_local 

Source
pub(crate) fn db_lookup_local(
    ctx: FunctionEnvMut<'_, Env>,
    ptr: WasmPtr<u8>,
    ptr_len: u32,
) -> i64
Expand description

Lookup a tx-local database handle from its name. Unlike the on-chain version, this will also initialize the database in-memory if it does not exist and the caller is allowed to write. Then it will push it to the list of transaction-local db_handles.

Returns the index of the DbHandle in the local_db_handles Vector on success. Otherwise, returns an error value.

This function can be called from any ContractSection.

ยงPermissions

  • ContractSection::Deploy
  • ContractSection::Metadata
  • ContractSection::Exec
  • ContractSection::Update