Skip to content

Commit

Permalink
chore: use CASE instead of IF
Browse files Browse the repository at this point in the history
  • Loading branch information
shpran committed Oct 23, 2023
1 parent 4c36f75 commit bcffb67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/kernel/persistence/smoothsql/class.Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit bcffb67

Please sign in to comment.