Get search field name.
Needed in case of searching for data in table oxartextends or its views.

@param string $table
@param string $field Chose table depending on field.

@return string
491628
protected function getSearchField($table, $field)
    {
        if ($field == 'oxlongdesc') {
            $searchField = getViewName('oxartextends', $this->_iLanguage) . ".{$field}";
        } else {
            $searchField = "{$table}.{$field}";
        }
        return $searchField;
    }
802333
function GetFieldInfo($table, $field)
    {
        $isUnique = false;
        $isPrimary = false;
        $isNullable = false;
        $defaultValue = null;
        $fullName = '';
        if (!$this->GetBasicFieldInfo($table, $field, $fullName, $defaultValue, $isPrimary, $isUnique, $isNullable))
        {
            return null;
        }
        $typeDef = TypeDef::ParseFullName($fullName);
        if (!$typeDef)
        {
            return null;
        }
        $keyName = $this->GetKeyName($table, $field);
        if (!$keyName)
        {
            return new FieldInfo($field, $typeDef, $defaultValue, $isNullable, null, null, null);
        }
        $keyInfo = new KeyInfo($keyName, $isPrimary, $isUnique);
        $constraintName = '';
        $refTable = '';
        $refField = '';
        if (!$this->GetForeignKey($table, $field, $constraintName, $refTable, $refField))
        {
            return new FieldInfo($field, $typeDef, $defaultValue, $isNullable, $keyInfo, null, null);
        }
        
        $onUpdate = null;
        $onDelete = null;
        $this->GetConstraintRules($constraintName, $onUpdate, $onDelete);
        $foreignKey = new ForeignKey($refTable, $refField);
        $constraint = new Constraint($constraintName, $onUpdate, $onDelete);
        return new FieldInfo($field, $typeDef, $defaultValue, $isNullable, $keyInfo, $foreignKey, $constraint);
    }
1265341
private static function _get_table_where(string $table): ?string
  {
    if (
      bbn\str::check_name($table) &&
      ($db = self::_get_db()) &&
      ($databases_obj = self::_get_databases()) &&
      ($model = $databases_obj->modelize($table))
    ){
      $col = $db->escape('col');
      $where_ar = [];
      foreach ( $model['fields'] as $k => $f ){
        if ( !empty($f['id_option']) ){
          $where_ar[] = $col.' = UNHEX("'.$db->escape_value($f['id_option']).'")';
        }
      }
      if ( \count($where_ar) ){
        return implode(' OR ', $where_ar);
      }
    }
    return null;
  }
1350883
public function getFieldType($field)
    {
        return isset($this->getFieldsConfig()[$field]) ? $this->getFieldsConfig()[$field]['type'] : null;
    }
112289
public function selectFromTable($table, $fields)
    {
        $fieldExpressions = array_map(function ($item) use ($table) {
            return Convert::symbol2sql("{$table}.{$item}");
        }, $fields);

        $this->query->setSelect($fieldExpressions);

        return $this;
    }
827918
public function get_field_select() : string {
        $fieldlist = $this->get_fieldlist();

        return implode(', ', array_map(function($fieldname, $fieldalias) {
            return "{$this->tablealias}.{$fieldname} AS {$fieldalias}";
        }, $fieldlist, array_keys($fieldlist)));
    }
538381
public function isFieldExists($table, $field)
	{
		if (isset($this->tables[$table])) {
			$fields = $this->getFields($table);

			return $fields->where('name', $field)->count() > 0;
		}

		return false;
	}
508086
public function getTableName($table) {
        if (preg_match('#^`?\{[^\}]+\}.*$#', $table)) {
            return $this->sanitize(str_replace(['{', '}'], [$this->tablePrefix, ''], $table));
        } else {
            return $this->sanitize($table);
        }
    }
1362599
public static function getColumnName($field)
    {
        static::init();
        if (!static::fieldExists($field)) {
            throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field);
        }

        return static::$_classFields[get_called_class()][$field]['columnName'];
    }
124391
protected function _getFields(Table $table)
    {
        $fields = explode(',', $this->args[1]);
        foreach ($fields as $field) {
            if (!$table->hasField($field)) {
                $this->abort(sprintf('Table `%s` is missing the field `%s`.', $table->table(), $field));
            }
        }

        return $fields;
    }
628636
public function getFieldType($field)
    {
        $definition = $this->getFieldDefinition($field);
        if ($definition && isset($definition['type'])) {
            return $definition['type'];
        }
    }
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;
    }
1325695
public function getDefaultValuesFields(Table $table)
    {
        return $table->getFields()->filter(function (Field $field) {
            return $field->getDefault() !== null;
        });
    }
44292
protected function computeExtractFieldName($field)
    {
        if ($this->hasNamingStrategy()) {
            $field = $this->getNamingStrategy()->extract($field);
        }
        return $field;
    }
1022647
public function tableHasField($table, $field)
	{
		$this->setQuery('SHOW FIELDS FROM ' . $table);
		$fields = $this->loadObjectList('Field');

		if (!is_array($fields))
		{
			return false;
		}

		return (in_array($field, array_keys($fields))) ? true : false;
	}
691919
public function getSearchOptions($table, string $field, array $options = []) : array
    {
        $handler = self::getByTableField($table, $field, $options, $this->cakeView);

        return $handler->getSearchOptions($options);
    }
865202
public function GetField($Field, $Table = '') {
      if ($Table != '')
         $this->CurrentTable = $Table;
      
      if (!is_array($this->_Schema))
         $this->_Schema = array();
         
      $Result = FALSE;
      if ($this->FieldExists($this->CurrentTable, $Field) === TRUE)
         $Result = $this->_Schema[$this->CurrentTable][$Field];
         
      return $Result;
   }