From 57b7527a466c25286de78c6c05a787ba21b48cf7 Mon Sep 17 00:00:00 2001 From: Sergey Tsalkov Date: Sun, 8 Aug 2021 14:15:19 +0000 Subject: [PATCH] fix bug in columnList(), add test --- db.class.php | 2 +- simpletest/BasicTest.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/db.class.php b/db.class.php index 07c9cf4..084484b 100644 --- a/db.class.php +++ b/db.class.php @@ -486,7 +486,7 @@ class MeekroDB { $columns[$row['Field']] = array( 'type' => $row['Type'], 'null' => $row['Null'], - 'key' => $row['Type'], + 'key' => $row['Key'], 'default' => $row['Default'], 'extra' => $row['Extra'] ); diff --git a/simpletest/BasicTest.php b/simpletest/BasicTest.php index 2f7fe52..e76f9d8 100644 --- a/simpletest/BasicTest.php +++ b/simpletest/BasicTest.php @@ -279,7 +279,10 @@ class BasicTest extends SimpleTest { $columns = DB::columnList('store data'); $this->assert(count($columns) === 2); $this->assert($columns['picture']['type'] === 'blob'); - + $this->assert($columns['picture']['null'] === 'YES'); + $this->assert($columns['picture']['key'] === ''); + $this->assert($columns['picture']['default'] === NULL); + $this->assert($columns['picture']['extra'] === ''); $smile = file_get_contents(__DIR__ . '/smile1.jpg'); DB::insert('store data', array(