Stringify column expressions

@param {Array} columns
@return {string}
11473
function columnsToSQL(columns, tables) {
  if (!columns) return
  const baseTable = Array.isArray(tables) && tables[0]
  let isDual = false
  if (baseTable && baseTable.type === 'dual') isDual = true
  return columns
    .map(column => {
      const { expr } = column
      if (isDual) expr.isDual = isDual
      let str = exprToSQL(expr)
      if (column.as !== null) {
        str = `${str} AS `
        if (column.as.match(/^[a-z_][0-9a-z_]*$/i)) str = `${str}${identifierToSql(column.as)}`

        else str = `${str}\`${column.as}\``
      }

      return str
    })
    .join(', ')
}
857884
final public static function getTypedColumns($columns)
    {
        static::checkUnknownColumn($columns);

        $result = Utils::arrayWhitelist(
            array_combine(self::getColumns(), static::COLUMNS),
            (array) $columns
        );

        return (is_string($columns))
            ? array_values($result)[0]
            : $result;
    }
1151499
function column(options) {
    return this.navigation.slice(0, 5).reduce(function reduce(columns, section) {
      return columns + options.fn(section);
    }, '');
  }
297539
function(str){
    var lines = str.match(/\n/g)
      , idx = str.lastIndexOf('\n');

    if (lines) this.lineno += lines.length;
    this.column = ~idx
      ? str.length - idx
      : this.column + str.length;
  }
907843
public static SelectColumn includes(String[] cols, String... columns) {
        return new SelectColumn(Utility.append(cols, columns), false);
    }
976396
public String[] buildColumnsAs(String[] columns, String value) {

		String[] values = new String[columns.length];
		for (int i = 0; i < columns.length; i++) {
			values[i] = value;
		}

		return buildColumnsAs(columns, values);
	}
180153
private function prepareColumns(array $columns, callable $columnCallable = null): string
    {
        foreach ($columns as &$column) {
            if (is_array($column)) {
                $column = $this->prepareColumns($column, $columnCallable);
            } else {
                $column = $this->prepareColumn($column, $columnCallable);
            }
        }
        unset($column);

        return '(' . implode(', ', $columns) . ')';
    }
923993
public Record remove(String... columns) {
		if (columns != null)
			for (String c : columns)
				this.getColumns().remove(c);
		return this;
	}
654499
protected function sanitizeColumns(array $columns)
    {
        $callback = $this->getCallback();
        if ($callback) {
            foreach ($columns as $key => $value) {
                $columns[$key] = $callback($value);
            }
        }

        if (!$this->enclosure) {
            return $columns;
        }

        foreach ($columns as $key => $value) {
            if (false !== strpos($value, $this->delimiter)
                || false !== strpos($value, $this->escape)
                || false !== strpos($value, $this->enclosure)
                || false !== strpos($value, $this->newline)
            ) {
                if ($this->escape != $this->enclosure) {
                    $value = str_replace($this->escape, $this->escape . $this->escape, $value);
                }
                $value = str_replace($this->enclosure, $this->escape . $this->enclosure, $value);
                $value = $this->enclosure . $value . $this->enclosure;

                $columns[$key] = $value;
            }
        }

        return $columns;
    }
723864
private function transformColumns($columns)
    {
        return array_map(function ($column) {
            return [
                'Field' => $column->Field,
                'Type' => $column->Type,
                'Null' => $column->Null,
                'Key' => $column->Key,
                'Default' => $column->Default,
                'Extra' => $column->Extra
            ];
        }, $columns);
    }
1177057
function validateColumns(columns) {
  if (!columns) {
    return;
  }

  // check IDs
  var ids = {};
  columns.forEach(function (column, i) {
    var id = column.id;

    if (!ids[id]) {
      ids[id] = [i];
    } else {
      ids[id].push(i);
    }
  });
  Object.keys(ids).forEach(function (id) {
    if (ids[id].length > 1) {
      console.warn('Column ID \'' + id + '\' used in multiple columns ' + ids[id].join(', '), ids[id].map(function (index) {
        return columns[index];
      }));
    }
  });
}
1278202
public function columns($columns = '*')
    {
        $result = '';
        if (is_array($columns)) {
            foreach ($columns as $key => $val) {
                $result .= ($result == '' ? '' : ', ') . (is_int($key) ? $val : ($key . " AS `{$val}`"));
            }
        } else {
            $result = implode(', ', func_get_args());
        }
        $this->sql['columns'] == '' || ($this->sql['columns'] .= ' ,');
        $this->sql['columns'] .= $result;
        return $this;
    }
530598
function stringify(data){
		switch(typeof data){
			case 'string':
				return '"'+ data.replace(reg_rep, function(a){
					return rep[a];
				}) +'"';
			
			case 'object':
				if(data===null){return 'null'}
				var res = [], k, v;
				if(data instanceof Array){
					var l = data.length;
					for(k = 0; k < l; k++){
						v = stringify(data[k]);
						v===undef || res.push(v);
					}
					return '['+ res.join(',') +']';
				}else{
					for(k in data){
						if(data.hasOwnProperty(k) && k){
							v = stringify(data[k]);
							(jskw[k] || reg_d.test(k)) && (k = '"'+k+'"');
							v===undef || res.push(k +':'+ v);
						}
					}
					return '{'+ res.join(',') +'}';
				}

			case 'number':
				return isFinite(data) ? data.toString() : 'null';
			
			case 'undefined':
			case 'unknown':
				return;
			case 'function':
			case 'boolean':
			case 'regexp':
				return data.toString();
		}
	}
327075
public function columns($columns) {
		if (is_array($columns))
			$this->columnList = $columns;
		else
			$this->columnList = func_get_args();
		return $this;
	}
689388
function getIdMapping(idColumnNames, columns) {
  var idColumns = getIdColumns(idColumnNames, columns);
  if (idColumns.length === 0) {
    return {};
  }
  return idColumns[0].values.reduce(function(result, value, rowNumber) {
    var idString = getIdStringForRowNumber(idColumns, rowNumber);
    if (!defined(result[idString])) {
      result[idString] = [];
    }
    result[idString].push(rowNumber);
    return result;
  }, {});
}
1187376
function (rows) {
		var row,
			rowsLength,
			col,
			colsLength,
			columns;

		if (rows) {
			columns = [];
			rowsLength = rows.length;
			for (row = 0; row < rowsLength; row++) {
				colsLength = rows[row].length;
				for (col = 0; col < colsLength; col++) {
					if (!columns[col]) {
						columns[col] = [];
					}
					columns[col][row] = rows[row][col];
				}
			}
		}
		return columns;
	}
836051
private function extractArrayAttributes($columns)
    {
        $i = 0;
        $str = '';
        $count = count($columns);
        while ($i < $count) { //Create conditions with and if value is passed as array
            $str .= $this->quoteIdentifier($columns[$i]);
            $str .= ($i < $count - 1) ? ',' : '';
            $i++;
        }

        return $str;
    }