]> git.nbdom.net Git - nb.git/commitdiff
table.create
authorNicolas Boisselier <nicolas.boisselier@semantico.com>
Wed, 29 Jun 2016 10:17:42 +0000 (11:17 +0100)
committerNicolas Boisselier <nicolas.boisselier@semantico.com>
Wed, 29 Jun 2016 10:17:42 +0000 (11:17 +0100)
lib/php/db/field.php
lib/php/db/table.php

index 8d0d4a3d56e2db42a31508ad59eed455116f3e0b..9d9900c11fb9345330f78d872741903980d9bb2e 100644 (file)
@@ -19,6 +19,7 @@ class field extends nb {
   public $default;
   public $autoincrement;
   public $extra;
+  public $extras;
 
   public function __sleep() { return array(
     'name',
@@ -68,7 +69,7 @@ class field extends nb {
     $size = ($this->size() and is_scalar($this->size())) ? $this->size() : 0;
     $tag = ( ($size>$this->textarea_size) or preg_match('/^(text|binary)/i',$this->type) ) ? 'textarea' : 'input';
     return '<div class="label '.$this->name.'"><label for="'.$this->name.'">'.htmlspecialchars(prettyText($this->name)).'</label>'
-      .($this->extra
+      .($this->extras
         ? '<span class="extra" id="'.$this->name.'">'.$this->out($value).'</span>'
         : '<'.$tag
           .' name="'.$this->name.'"'
@@ -227,7 +228,7 @@ class field extends nb {
       $value = sprintf('%.'.$m[1].'f',$value);
     }
 
-    if ($html_escape and empty($this->extra)) $row[$f] = htmlspecialchars($row[$f]);
+    if ($html_escape and empty($this->extras)) $row[$f] = htmlspecialchars($row[$f]);
     return $value;
   }
 
index e4abc4fc0a38db6160efdc1ee7ec4ae4e835535a..6165a7a091a391b216c8b6e966e5979baacd1895 100644 (file)
@@ -536,13 +536,13 @@ Class Table extends nb {
 
       # having, denorm, EMPTY
       $extra_where = (string)$this->db()->type('extra_where');
-      if ($extra_where == 'having' and $field->extra) {
+      if ($extra_where == 'having' and $field->extras) {
         $having[] = $this->extras[$k]->sql_name()."$equal$v";
 
-      } elseif ($extra_where == 'denorm' and $field->extra) {
+      } elseif ($extra_where == 'denorm' and $field->extras) {
         $where[] = $this->extras[$k]->sql_name()."$equal$v";
 
-      } elseif ($field->extra) {
+      } elseif ($field->extras) {
         $where[] = $this->extras[$k]->sql_name()."$equal$v";
       } else {
         $where[] = $field->sql_name()."$equal$v";
@@ -575,7 +575,7 @@ Class Table extends nb {
       $v = new Field( ( is_array($v) ? $v : array() ) + array(
         'name' => $k,
         'type' => 'text',
-        'extra' => $v,
+        'extras' => $v,
       ));
 
       $this->fields[$k] = $v;