From 16c99894c7c6d7b96806433630b21ee425276d92 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Wed, 14 Feb 2024 12:48:11 +0900 Subject: [PATCH] =?UTF-8?q?=E5=90=8D=E5=89=8D=E7=A9=BA=E9=96=93=E3=81=AE?= =?UTF-8?q?=E5=8F=82=E7=85=A7=E3=81=A1=E3=82=87=E3=81=A3=E3=81=A8=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- daos/response.php | 8 ++++---- daos/thread.php | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/daos/response.php b/daos/response.php index 1d9aa6d..921401a 100644 --- a/daos/response.php +++ b/daos/response.php @@ -8,8 +8,8 @@ Response { public static function fetch_all ( - SQLite3 $db, - int $thread_id) + \SQLite3 $db, + int $thread_id) : array { $sql = " @@ -59,7 +59,7 @@ Response public static function like ( - SQLite3 $db, + \SQLite3 $db, int $thread_id, int $response_id) : void @@ -79,7 +79,7 @@ Response public static function dislike ( - SQLite3 $db, + \SQLite3 $db, int $thread_id, int $response_id) : void diff --git a/daos/thread.php b/daos/thread.php index 9f7ecb7..9cd44f9 100644 --- a/daos/thread.php +++ b/daos/thread.php @@ -8,7 +8,7 @@ Thread { public static function fetch_all ( - SQLite3 $db) + \SQLite3 $db) : array { $sql = " @@ -53,8 +53,8 @@ Thread public static function find ( - SQLite3 $db, - int $id) + \SQLite3 $db, + int $id) : ?\Dto\Thread { $sql = " @@ -77,6 +77,10 @@ Thread latest DESC"; $result = $db -> query ($sql); + + if ($row === false) + return null; + $row = $result -> fetchArray (SQLITE3_ASSOC); if ($row === false) @@ -95,9 +99,9 @@ Thread public static function create_thread ( - SQLite3 $db, - string $title, - string $explain) + \SQLite3 $db, + string $title, + string $explain) : void { ; @@ -106,7 +110,7 @@ Thread public static function delete_thread ( - SQLite3 $db, + \SQLite3 $db, int $id) : void {