From f4029e068929398f15acf351f01ea557c11c4abb Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 5 Feb 2022 09:24:39 +0000 Subject: [PATCH] Ensure remote record fetching works correctly --- src/sql/value/get.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sql/value/get.rs b/src/sql/value/get.rs index 158fa7d7..18368809 100644 --- a/src/sql/value/get.rs +++ b/src/sql/value/get.rs @@ -64,7 +64,7 @@ impl Value { // Current path part is a thing Value::Thing(v) => match path.parts.len() { // No remote embedded fields, so just return this - 1 => Ok(Value::Thing(v.clone())), + 0 => Ok(Value::Thing(v.clone())), // Remote embedded field, so fetch the thing _ => { let stm = SelectStatement { @@ -72,10 +72,12 @@ impl Value { what: Values(vec![Value::Thing(v.clone())]), ..SelectStatement::default() }; - match stm.compute(ctx, opt, exe, None).await { - Ok(v) => v.get(ctx, opt, exe, &path.next()).await, - Err(_) => Ok(Value::None), - } + stm.compute(ctx, opt, exe, None) + .await? + .first(ctx, opt, exe) + .await? + .get(ctx, opt, exe, &path) + .await } }, // Ignore everything else