diff --git a/core/database.php b/core/database.php index 10441027..3b286021 100644 --- a/core/database.php +++ b/core/database.php @@ -220,21 +220,6 @@ class Database return $row ? $row : null; } - - /** - * Execute an SQL query and return a boolean based on whether it returns a result - */ - public function exists(string $query, array $args=[], bool $scoreql = false): bool - { - if ($scoreql===true) { - $query = $this->scoreql_to_sql($query); - } - $_start = microtime(true); - $result = $this->execute($query, $args); - $this->count_time("exists", $_start, $query, $args); - return $result->rowCount()>0; - } - /** * Execute an SQL query and return the first column of each row. */ diff --git a/ext/favorites/main.php b/ext/favorites/main.php index 0c54382b..f4791dab 100644 --- a/ext/favorites/main.php +++ b/ext/favorites/main.php @@ -227,7 +227,7 @@ class Favorites extends Extension { global $database; if ($do_set) { - if (!$database->exists("select 1 from user_favorites where image_id=:image_id and user_id=:user_id", ["image_id"=>$image_id, "user_id"=>$user_id])) { + if (!$database->get_row("select 1 from user_favorites where image_id=:image_id and user_id=:user_id", ["image_id"=>$image_id, "user_id"=>$user_id])) { $database->Execute( "INSERT INTO user_favorites(image_id, user_id, created_at) VALUES(:image_id, :user_id, NOW())", ["image_id"=>$image_id, "user_id"=>$user_id]