From bcffb674c957807bfbcd4fc213c0087c72944939 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Tue, 24 Oct 2023 01:40:37 +0300 Subject: [PATCH] chore: use CASE instead of IF --- core/kernel/persistence/smoothsql/class.Resource.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/kernel/persistence/smoothsql/class.Resource.php b/core/kernel/persistence/smoothsql/class.Resource.php index 35c44cc99..750b4717a 100644 --- a/core/kernel/persistence/smoothsql/class.Resource.php +++ b/core/kernel/persistence/smoothsql/class.Resource.php @@ -219,7 +219,11 @@ public function getNestedResources(string $classId): array ON s.object = st.subject WHERE s.predicate IN (?, ?) ) -SELECT subject as id, IF(predicate = ?, 1, 0) as isClass, level FROM statements_tree; +SELECT + subject as id, + CASE WHEN predicate = ? THEN 1 ELSE 0 END as isClass, + level +FROM statements_tree; SQL; $statement = $this->getPersistence()->query(