From c2829d9408c52077aca618cc10b753d1e760bb61 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 25 Sep 2023 10:34:11 +0900 Subject: [PATCH] docs: add changelog --- system/Commands/Database/ShowTableInfo.php | 18 ++++++++++++++++++ .../Commands/Database/ShowTableInfoTest.php | 12 ++++++++++++ user_guide_src/source/changelogs/v4.4.2.rst | 3 +++ 3 files changed, 33 insertions(+) diff --git a/system/Commands/Database/ShowTableInfo.php b/system/Commands/Database/ShowTableInfo.php index 07aa60c961ca..3b5dae4fcbe3 100644 --- a/system/Commands/Database/ShowTableInfo.php +++ b/system/Commands/Database/ShowTableInfo.php @@ -102,6 +102,8 @@ public function run(array $params) $this->db = Database::connect(); $this->DBPrefix = $this->db->getPrefix(); + $this->showDBConfig(); + $tables = $this->db->listTables(); if (array_key_exists('desc', $params)) { @@ -145,6 +147,22 @@ public function run(array $params) $this->showDataOfTable($tableName, $limitRows, $limitFieldValue); } + private function showDBConfig(): void + { + $data = [[ + 'hostname' => $this->db->hostname, + 'database' => $this->db->database, + 'username' => $this->db->username, + 'DBDriver' => $this->db->DBDriver, + 'DBPrefix' => $this->DBPrefix, + 'port' => $this->db->port, + ]]; + CLI::table( + $data, ['hostname', 'database', 'username', 'DBDriver', 'DBPrefix', 'port'] + ); + + } + private function removeDBPrefix(): void { $this->db->setPrefix(''); diff --git a/tests/system/Commands/Database/ShowTableInfoTest.php b/tests/system/Commands/Database/ShowTableInfoTest.php index be52a71b2991..bd123cc4254d 100644 --- a/tests/system/Commands/Database/ShowTableInfoTest.php +++ b/tests/system/Commands/Database/ShowTableInfoTest.php @@ -183,4 +183,16 @@ public function testDbTableAllOptions(): void EOL; $this->assertStringContainsString($expected, $result); } + + public function testDbTableWithInvalidDbConfig(): void + { + $config = config(Database::class); + $config->tests['database'] = 'invalid database name'; + + command('db:table --show'); + + $result = $this->getNormalizedResult(); + + dd($result); + } } diff --git a/user_guide_src/source/changelogs/v4.4.2.rst b/user_guide_src/source/changelogs/v4.4.2.rst index 19f2a4f1782c..eeb985b8ee7e 100644 --- a/user_guide_src/source/changelogs/v4.4.2.rst +++ b/user_guide_src/source/changelogs/v4.4.2.rst @@ -30,6 +30,9 @@ Deprecations Bugs Fixed ********** +- **Spark:** Fixed a bug that caused spark to not display exceptions or to display + backtrace in json when an exception occurred. + See the repo's `CHANGELOG.md `_ for a complete list of bugs fixed.