From: Nicolas Boisselier Date: Wed, 29 Jun 2016 10:17:42 +0000 (+0100) Subject: table.create X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=dee04ace023dcf23902b6640e36f0f9322f1026d;p=nb.git table.create --- diff --git a/lib/php/db/field.php b/lib/php/db/field.php index 8d0d4a3d..9d9900c1 100644 --- a/lib/php/db/field.php +++ b/lib/php/db/field.php @@ -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 '
' - .($this->extra + .($this->extras ? ''.$this->out($value).'' : '<'.$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; } diff --git a/lib/php/db/table.php b/lib/php/db/table.php index e4abc4fc..6165a7a0 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -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;