TODO

@param $table
@param $field
@return string
178661
public function getAlterAdd($table, $field)
    {
        $table = $this->validTableName($table);
        $name = $field['field'];
        $type = $field['type'];
        if (isset($field['default']) && $field['default'] !== '') {
            $type .= " DEFAULT '" . $field['default'] . "'";
        }
        return 'ALTER TABLE ' . $table . ' ADD `' . $name . '` ' . $type;
    }
639930
public function getAlterChange($table, $field)
    {
        $table = $this->validTableName($table);

        $name = $field['field'];
        $type = $field['type'];
        if (isset($field['autoincrement']) && $field['autoincrement']) {
            $type .= ' AUTO_INCREMENT';
        }
        if (isset($field['default']) && $field['default'] !== null && $field['default'] != '') {
            $type .= ' DEFAULT \'' . $field['default'] . '\'';
        }

        return 'ALTER TABLE ' . $table . ' CHANGE `' . $name . '` `' . $name . '` ' . $type;
    }
628636
public function getFieldType($field)
    {
        $definition = $this->getFieldDefinition($field);
        if ($definition && isset($definition['type'])) {
            return $definition['type'];
        }
    }
113255
public function type($field)
    {
        $parts = explode('.', $field);
        $table = $this->_getTable($parts);

        return $table->getSchema()->baseColumnType(array_pop($parts));
    }
1067542
public function getCharacterSet($table, $field = null)
	{
		// Postgres only supports encodings for an entire database
		// Not encodings on a per-table or per-column level.
		$this->setQuery("SELECT * FROM information_schema.character_sets;");

		$result = $this->loadResult();

		return $result ? $result : false;
	}
849200
private function getReplaceQuery($table, $field)
    {
        return sprintf(
            'UPDATE %s SET %s = REPLACE(%s, "%s", "%s") WHERE 1=1', 
            $table, 
            $field,
            $field,
            str_replace('\\', '\\\\', AbstractContent::CLASSCONTENT_BASE_NAMESPACE),
            ''
        );
    }
1229955
public function generateFieldID($field)
    {
        if ($form = $field->getForm()) {
            return sprintf(
                "%s_%s",
                $this->generateFormID($form),
                Convert::raw2htmlid($field->getName())
            );
        }

        return Convert::raw2htmlid($field->getName());
    }
714998
public static function quoteField($field) {
        $trimmedField = trim($field);
        if ($trimmedField == '*') {
            return $trimmedField;
        }

        if (strpos($trimmedField, ' ') !== false) {
            return $trimmedField;
        }

        return strpos($trimmedField, '.') !== false ?
                $trimmedField : "`{$trimmedField}`";
    }
664179
public function fieldQuery($field)
    {
        $query = $this->dsql()->del('fields');
        if (is_string($field)) {
            $field = $this->getElement($field);
        }
        $field->updateSelectQuery($query);

        return $query;
    }
40704
public function table($table): string
	{
		if($table instanceof Raw)
		{
			return $this->raw($table);
		}
		elseif($table instanceof Subquery)
		{
			return $this->subquery($table);
		}
		elseif(stripos($table, ' AS ') !== false)
		{
			[$table, , $alias] = explode(' ', $table, 3);

			return sprintf('%s AS %s', $this->escapeTable($table), $this->escapeTable($alias));
		}

		return $this->escapeTable($table);
	}
1128277
public function column($field = 'ID')
    {
        $fieldExpression = $this->expressionForField($field);
        $query = $this->getFinalisedQuery(array($field));
        $originalSelect = $query->getSelect();
        $query->setSelect(array());
        $query->selectField($fieldExpression, $field);
        $this->ensureSelectContainsOrderbyColumns($query, $originalSelect);

        return $query->execute()->column($field);
    }
1347061
public function getFieldsType($tableName = '', $field = null)
    {
        if ('' == $tableName) {
            $tableName = isset($this->options['table']) ? $this->options['table'] : $this->getTable();
        }

        return $this->connection->getFieldsType($tableName, $field);
    }
1194678
protected function getLocalizedFileReference(string $table, string $field) {
    if ($this->getSysLanguageUid() > 0) {
      $localizedFileReferences = $this->getLocalizedFileReferences($table, $field);

      if (!empty($localizedFileReferences)) {
        $localizedFileObject = $localizedFileReferences[0]->toArray();

        if ($localizedFileObject) {
          $pid = intval($localizedFileObject['pid']);
          $uid = intval($localizedFileObject['uid']);

          $fileReference                = new FileReference();
          $fileReference->pid           = $pid;
          $fileReference->uid           = $uid;
          $fileReference->_languageUid  = 0;
          $fileReference->_localizedUid = $uid;
          $fileReference->_versionedUid = $uid;

          return $fileReference;
        }
      }
    }

    return null;
  }
902853
public function getAlterDrop($table, $field, $name = null)
    {
        $table = $this->validTableName($table);
        if ($name === null) {
            $name = $field['field'];
        }
        return "ALTER TABLE $table DROP COLUMN `{$name}`";
    }
628864
public function format_object($field)
    {
        $this->current_row[$field] = (string) $this->current_row[$field];

        return $this->format_shorttext($field);
    }
28866
public function getCellValue($field)
    {
        $fieldName = $field instanceof FieldConfig ? $field->getName() : $field;
        return $this->extractCellValue($fieldName);
    }
1335807
private function getFieldValue($field)
    {
        return isset($this->values[$field]) ? $this->values[$field] : null;
    }