From 7cd5eef2186937c7ba00ede6111d78ac47c71b53 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 8 Nov 2023 20:29:09 +0100 Subject: [PATCH] InstanceEnv::delete_by_col_eq: return u32 instead of NonZeroU32 (#539) --- crates/core/src/host/instance_env.rs | 8 +++----- crates/core/src/host/wasmer/wasm_instance_env.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/core/src/host/instance_env.rs b/crates/core/src/host/instance_env.rs index 049879b851..52f8b89e03 100644 --- a/crates/core/src/host/instance_env.rs +++ b/crates/core/src/host/instance_env.rs @@ -1,7 +1,6 @@ use nonempty::NonEmpty; use parking_lot::{Mutex, MutexGuard}; use spacetimedb_lib::{bsatn, ProductValue}; -use std::num::NonZeroU32; use std::ops::DerefMut; use std::sync::Arc; @@ -159,7 +158,7 @@ impl InstanceEnv { table_id: TableId, col_id: ColId, value: &[u8], - ) -> Result { + ) -> Result { let stdb = &*self.dbic.relational_db; let tx = &mut *self.get_tx()?; @@ -172,9 +171,8 @@ impl InstanceEnv { .map(|x| RowId(*x.id())) .collect::>(); - // Delete them and count how many we deleted and error if none. - let count = stdb.delete(tx, table_id, rows_to_delete); - NonZeroU32::new(count).ok_or(NodesError::ColumnValueNotFound) + // Delete them and count how many we deleted. + Ok(stdb.delete(tx, table_id, rows_to_delete)) } /// Deletes all rows in the table identified by `table_id` diff --git a/crates/core/src/host/wasmer/wasm_instance_env.rs b/crates/core/src/host/wasmer/wasm_instance_env.rs index 79743e94da..ff37d131ff 100644 --- a/crates/core/src/host/wasmer/wasm_instance_env.rs +++ b/crates/core/src/host/wasmer/wasm_instance_env.rs @@ -481,7 +481,7 @@ impl WasmInstanceEnv { .data() .instance_env .delete_by_col_eq(&ctx, table_id.into(), col_id.into(), &value)?; - Ok(count.get()) + Ok(count) }, ) }