From bd08a4a14d544c3507530c8567ff32f4a4b6dd48 Mon Sep 17 00:00:00 2001 From: simonLeary42 <71396965+simonLeary42@users.noreply.github.com> Date: Fri, 28 Mar 2025 02:47:59 -0400 Subject: [PATCH 1/3] site var not found is an error --- resources/lib/UnitySQL.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/lib/UnitySQL.php b/resources/lib/UnitySQL.php index 8a82bb2..8ad0f71 100644 --- a/resources/lib/UnitySQL.php +++ b/resources/lib/UnitySQL.php @@ -1,6 +1,7 @@ bindParam(":name", $name); $stmt->execute(); - - return $stmt->fetchAll()[0]['value']; + $result = $stmt->fetchAll(); + if (empty($result)) { + throw new Exception("Site variable with name '$name' not found."); + } + if (count($result) > 1) { + throw new Exception("Multiple site variables found with name '$name'. Expected only one."); + } + return $result[0]['value']; } public function updateSiteVar($name, $value) From 9cedf4501e4c9fa162f084d267db498f42f4993f Mon Sep 17 00:00:00 2001 From: simonLeary42 <71396965+simonLeary42@users.noreply.github.com> Date: Fri, 28 Mar 2025 03:04:23 -0400 Subject: [PATCH 2/3] Update UnitySQL.php --- resources/lib/UnitySQL.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lib/UnitySQL.php b/resources/lib/UnitySQL.php index 8ad0f71..7d8aa9c 100644 --- a/resources/lib/UnitySQL.php +++ b/resources/lib/UnitySQL.php @@ -1,6 +1,7 @@ Date: Fri, 28 Mar 2025 03:08:22 -0400 Subject: [PATCH 3/3] Update UnitySQL.php --- resources/lib/UnitySQL.php | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/lib/UnitySQL.php b/resources/lib/UnitySQL.php index 7d8aa9c..63d4c4c 100644 --- a/resources/lib/UnitySQL.php +++ b/resources/lib/UnitySQL.php @@ -3,7 +3,6 @@ namespace UnityWebPortal\lib; use Exception; - use PDO; class UnitySQL