public function _render_field()
{
$ret = [];
if (!$this->args['field']) {
throw new Exception(['No fields defined for table']);
}
foreach ($this->args['field'] as $field => $options) {
if ($options instanceof Expression) {
$ret[] = $this->_escape($field) . ' ' . $this->_consume($options);
continue;
}
$type = strtolower(isset($options['type']) ? $options['type'] : 'varchar');
$type = preg_replace('/[^a-z0-9]+/', '', $type);
$len = isset($options['len']) ? $options['len'] : ($type === 'varchar' ? 255 : null);
$ret[] = $this->_escape($field) . ' ' . $type . ($len ? '(' . $len . ')' : '');
}
return implode(',', $ret);
}