Get all columns affected by a statement

@access public
@return array $columns Array containing the columns
168072
private function get_columns() {
		$meta = $this->result_metadata();

		// FIXME: This is a check to be compatible with PHP versions > 5.3.6
		// Not having the database name in the key results in name collisions when using multiple databases
		if (version_compare(PHP_VERSION, '5.3.6') >= 0) {
			$database_in_key = true;
		} else {
			$database_in_key = false;
		}

		$columns = [];
		while ($column = $meta->fetch_field()) {
			if ($database_in_key === true) {
				$columns[] = $column->db . '.' . $column->table . '.' . $column->name;
			} else {
				$columns[] = $column->table . '.' . $column->name;
			}
		}
		return $columns;
	}
1046020
protected function columnsToDisplay()
    {
        if (!$this->input->hasOption('columns')) {
            return [];
        }
        $columns = $this->input->getOption('columns');
        if (count($columns) === 1) {
            $columns = preg_split('/\s*,\s*/', $columns[0]);
        }

        return $columns;
    }
1034043
public function _render_statements()
    {
        $result = [];

        if (isset($this->args['dropField'])) {
            foreach ($this->args['dropField'] as $field => $junk) {
                $result[] = 'drop column '.$this->_escape($field);
            }
        }

        if (isset($this->args['newField'])) {
            foreach ($this->args['newField'] as $field => $option) {
                $result[] = 'add column '.$this->_render_one_field($field, $option);
            }
        }

        if (isset($this->args['alterField'])) {
            foreach ($this->args['alterField'] as $field => $option) {
                $result[] = 'change column '.$this->_escape($field).' '.$this->_render_one_field($field, $option);
            }
        }

        return implode(', ', $result);
    }
883340
public function toArray()
    {
        $arrayResult = array(
            'affected' => $this->getAffected(),
            'insertId' => $this->getInsertId(),
            'startRow' => $this->getStartRow(),
            'totalRows' => $this->getTotalRows(),
            'totalShows' => $this->getTotalShows(),
            'start' => $this->getStart(),
            'end' => $this->getEnd(),
            'seconds' => $this->getSeconds(),
            'types' => $this->getTypes(),
            'columns' => $this->getColumns(),
            'data' => array(),
        );

        if ($this->dataType instanceof DataInterface) {
            for ($i = 0; $i < $this->length(); ++$i) {
                if ($this->hasIndex($i)) {
                    $arrayResult['data'][] = $this->getIndex($i)->toArray();
                }
            }
        } else {
            $arrayResult['data'] = $this->getArrayCopy();
        }

        return $arrayResult;
    }
1129843
public function getColumns()
    {
        $primaryKey        = $this->getPrimaryKey();
        $primaryKeyColumns = [];

        if ($primaryKey !== null) {
            $primaryKeyColumns = $this->filterColumns($primaryKey->getColumns());
        }

        return array_merge($primaryKeyColumns, $this->getForeignKeyColumns(), $this->_columns);
    }
1348647
public function getUniqueColumns()
    {
        $result = array();
        $columns = $this->getColumns(true);

        foreach ($columns as $name => $description)
        {
            if ($description->unique) {
                $result[$name] = $description;
            }
        }

        return $result;
    }
130849
public function getColumns()
    {
        if (empty($this->_columns)) {
            $properties = $this->getInspector()->getClassProperties();
            foreach ($properties as $property) {
                $annotations = $this->getInspector()
                    ->getPropertyAnnotations($property);
                if ($annotations->hasAnnotation('column')) {
                    $this->_columns[$property] =
                        $annotations->getAnnotation('column');
                    $this->_columns[$property]->field = trim($property, '_');
                }
            }
        }
        return $this->_columns;
    }
1265043
public function getColNames()
    {
        $colNames = array();
        foreach ($this->_array as $row) {
            foreach (array_keys($row) as $key) {
                if (!is_numeric($key) && !isset($colNames[$key])) {
                    $colNames[$key] = $key;
                }
            }
        }
        return $colNames;
    }
236739
public function affectedRows()
	{
		try {
			return $this->_statement->rowCount();
		} catch ( PDOException $e ) {
			throw new MW_DB_Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
		}
	}
932578
public static function all()
    {
        global $wpdb;

        $dbResults = $wpdb->get_results('SELECT * FROM ' . static::getTableName());
        $result = [];
        $model = get_called_class();
        foreach ($dbResults as $dbResult) {
            $modelObject = new $model();
            foreach (self::$columns as $column) {
                $modelObject->$column = $dbResult->$column;
            }
            $result[] = $modelObject;
        }

        return $result;
    }
276897
public function getLeftColumns()
    {
        $columns = array();
        foreach ($this->left as $index => $column) {
            $columns[] = $this->getLeftColumn($index);
        }

        return $columns;
    }
168390
public function columns(): array
    {
        $columns = $this->columns ?: [];

        if ( ! count($columns)) {
            $columns = $this->getGroupContentColumns();
        }

        // If columns are set, fill them out if they don't fit the grid
        if ($remainder = $this->getRemainderForColumns($columns)) {
            $columns[ count($columns) - 1 ] += $remainder;
        }

        return $columns;
    }
385422
public function columns()
    {
        $columns = self::config()->columns;
        if (!Security::config()->get('login_recording')) {
            unset($columns['LastLoggedIn']);
        }
        return $columns;
    }
697643
protected function getAllColumnsForSelect() {
        $with = is_array($this->with) ? $this->with : ($this->with ? explode(',', $this->with) : array());
        if (!count($with))
            return ['*'];
        $model = $this->model;
        $db = $model::getDb();
        $columns = $this->_columnsForModel($model::getTableName(), $db);
        foreach ($this->relationsParser->getListOfSelectedRelations() as $name=>$relation){
            $cols = $this->_columnsForRelation($relation, $db, $name);
            foreach ($cols as $column) {
                $columns[] = $column;
            }
        }
        return $columns;
    }
1092732
public function getFresh($columns = array('*'))
	{
		// If no columns have been specified for the select statement, we will set them
		// here to either the passed columns, or the standard default of retrieving
		// all of the columns on the table using the "wildcard" column character.
		if (is_null($this->columns))
		{
			$this->columns = $columns;
		}

		// Drop all columns if * is present, MongoDB does not work this way
		if (in_array('*', $this->columns))
		{
			$this->columns = array();
		}

		// Compile wheres
		$wheres = $this->compileWheres();

		// Aggregation query.
		if (isset($this->aggregate['function']))
		{
			switch ($this->aggregate['function'])
			{
				case 'count':
					$result = $this->collection->group(array(
						'key' => array('_id' => true),
						'initial' => array('count' => 0),
						'reduce' => "function(doc,out){ out.count++;}",
						'condition' => $wheres,

					));

					$result = count($result);
					break;

				case 'max':
				case 'min':
					$result = $this->collection->query(array(
						'query' => $wheres,
						'fields' => $this->columns,
						'sort' => array($this->columns[0] => $this->aggregate['function'] === 'max' ? -1 : 1),
						'limit' => 1,
					));
					$result = empty($result) ? 0 : $result[0][$this->columns[0]];
					break;

				default:
					$result = array();
					break;
			}

			return array(
				array(
					'aggregate' => $result,
				),
			);
		}
		// Normal query
		else
		{
			// Execute query.
			return $this->collection->query(array(
				'query' => $wheres,
				'fields' => $this->columns,
				'sort' => $this->orders,
				'skip' => $this->offset,
				'limit' => $this->limit,
			));
		}
	}
1328499
final public static function getColumns()
    {
        $result = [];
        foreach (static::COLUMNS as $column) {
            $result[] = trim(explode('[', $column, 2)[0]);
        }
        return $result;
    }
556048
public function getColumns()
    {
        $columns = ArrayList::create();
        
        foreach ($this->getEnabledChildren() as $child) {
            
            $columns->push(
                ArrayData::create([
                    'Child' => $child,
                    'ColumnClass' => $this->ColumnClass
                ])
            );
            
        }
        
        return $columns;
    }