]> git.nbdom.net Git - nb.git/commitdiff
db.php for mysql
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 8 Jun 2015 16:23:29 +0000 (17:23 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 8 Jun 2015 16:23:29 +0000 (17:23 +0100)
lib/php/db.php

index 37db523ae01746ef5708909c9354c4dd15e0417b..1311a5da8122ab4bd73bcd102022bbe30ea109d8 100644 (file)
@@ -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;
+
+        }
+
       }
 
     }