From f9ddcfb3497cf9789f685f46648486c8a7b1ec85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Apr 2021 15:26:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Connection.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Database/Connection.php b/Database/Connection.php index bbeb384a..633821ab 100644 --- a/Database/Connection.php +++ b/Database/Connection.php @@ -11,15 +11,13 @@ declare(strict_types=1); namespace Database; -use Annotation\Aspect; -use JetBrains\PhpStorm\Pure; -use ReflectionException; -use Snowflake\Abstracts\Component; use Database\Mysql\Schema; use Exception; +use JetBrains\PhpStorm\Pure; use PDO; +use ReflectionException; +use Snowflake\Abstracts\Component; use Snowflake\Event; -use Snowflake\Exception\ComponentException; use Snowflake\Exception\NotFindClassException; use Snowflake\Snowflake; @@ -155,10 +153,10 @@ class Connection extends Component #[Pure] public function isWrite($sql): bool { if (empty($sql)) return false; - - $prefix = strtolower(mb_substr($sql, 0, 6)); - - return in_array($prefix, ['insert', 'update', 'delete']); + if (str_starts_with(strtolower($sql), 'select')) { + return false; + } + return true; } /**