From: Nicolas Boisselier Date: Mon, 8 Jun 2015 16:23:29 +0000 (+0100) Subject: db.php for mysql X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=83fabdf5a740571ff6318b8f4b0f47935e72754e;p=nb.git db.php for mysql --- diff --git a/lib/php/db.php b/lib/php/db.php index 37db523a..1311a5da 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -253,10 +253,18 @@ class table { foreach ($rows as $row) { - $this->fields[$row['name']]['type'] = $row['type']; - $this->fields[$row['name']]['null'] = $row['notnull'] == '0' ? 1 : 0; $this->fields[$row['name']]['extra'] = null; + $this->fields[$row['name']]['type'] = $row['type']; + + if (array_key_exists('notnull',$row)) { + $this->fields[$row['name']]['null'] = $row['notnull'] == '0' ? 1 : 0; + + } else { + $this->fields[$row['name']]['null'] = preg_match('/^1|yes|t/i',$row['null']) ? 1 : 0; + + } + } }