Gets the key field name.
@return string
@throws \Exception if no key field exists
326679
final function KeyField()
    {
        if (!$this->keyField)
        {
            $fieldMappers = $this->FieldMappers();
            foreach ($fieldMappers as $name=>$mapper)
            {
                $keyInfo = $mapper->FieldInfo()->KeyInfo();
                if ($keyInfo && $keyInfo->IsPrimary())
                {
                    $this->keyField = $name;
                    break;
                }
            }
            if (!$this->keyField)
            {
                throw new \Exception('No (primary) key field found in ' . $this->TableName());
            }
        }
        return $this->keyField;
    }
120781
public function getName()
	{
		if (empty($this->_name))
		{
			$this->_name = \App::get('request')->getCmd('controller');

			if (!$this->_name)
			{
				$r = null;

				if (!preg_match('/View((view)*(.*(view)?.*))$/i', get_class($this), $r))
				{
					throw new Exception('Cannot get or parse view class name.', 500);
				}

				if (strpos($r[3], 'view'))
				{
					throw new Exception('Classname contains the substring "view" which causes problems when extracting the classname.', 500);
				}

				$this->_name = strtolower($r[3]);
			}
		}
		return $this->_name;
	}
797000
protected function _getKey()
    {
        $view = $this->getView();
        $key  = $view->getIdentifier().'-'.$view->getLayout();

        if ($this->getMixer() instanceof KControllerModellable)
        {
            $state = $this->getModel()->getState()->getValues();
            $key  .= ':'.md5(http_build_query($state, '', '&'));
        }

        return $key;
    }
808145
public function getNames()
    {
        if($this->isKeycacheInvalid())
        {
            $this->regenerateKeyCache();
        }
        if(is_array($this->__keycacheindex))
        {
            return $this->__keycacheindex;
        }
        return array();
    }
995327
public function getFieldString()
    {
        $fieldString = "`" . $this->m_name . "` " . $this->m_type;
        
        if ($this->m_constraint != null)
        {
            $fieldString .= " (" . $this->m_constraint . ")";
        }
                
        if ($this->isAutoIncrementing())
        {
            $fieldString .= " AUTO_INCREMENT";
        }
        
        if ($this->m_default !== null)
        {
            $fieldString .= " DEFAULT " . $this->m_default;
        }
        
        if (!$this->m_allowNull)
        {
            $fieldString .= " NOT NULL";
        }
        
        return $fieldString;
    }
934606
public function get_hostname() {
		$retval = null;
		if(isset($this->connectParams['host'])) {
			$retval = $this->connectParams['host'];
		}
		else {
			throw new \Exception(__METHOD__ .": HOST parameter missing");
		}
		return($this->connectParams['host']);
	}
1319094
public function getPrefixedFieldName()
    {
        $field_name = $this->field->getAttribute('field_name');

        if ($this->prefix) {
            return $this->prefix.'.'.$field_name;
        }

        return $field_name;
    }
159326
public function fieldName()
    {
        if ($formatted = $this->formatFieldName($this->key)) {
            return $formatted;
        } elseif (strpos($this->key, '_id')) {
            return str_replace('_id', '', $this->key);
        } else {
            return $this->key;
        }
    }
420231
private function getFieldData($field)
    {
        if (!isset($this->_fieldData[$field])) {
            foreach ($this->fields as $f) {
                if (($f['key'] === $field) || ($f['name'] === $field)) {
                    $this->_fieldData[$field] = $f;
                    break;
                }
            }
        }

        if (isset($this->_fieldData[$field])) {
            return $this->_fieldData[$field];
        } else {
            throw new Exception("Field $field does not exist");
        }
    }
921420
protected function getKeyString()
    {
        $expected = $this->expected;
        $keys = '';
        $tail = array_pop($expected);

        if (!empty($expected)) {
            $keys = implode('","', $expected) . '", and "';
        }

        $keys .= $tail;

        return $keys;
    }
1076637
public function key()
    {
        if (($this->endItemIdx !== null) && isset($this->lastItems[$this->endItemIdx])) {
            return $this->lastItems[$this->endItemIdx][0];
        } else {
            if (isset($this->firstItems[$this->firstItemIdx])) {
                return $this->firstItems[$this->firstItemIdx][0];
            } else {
                return $this->extractValue($this->items->current(), $this->keyField);
            }
        }
    }
462576
public function getKey(): string
    {
        $argKeys = $this->argKeys();

        return $this->implode([
            $this->privateCache
                ? 'auth'
                : null,
            $this->privateCache
                ? app('auth')->user()->getKey()
                : null,
            strtolower($this->resolveInfo->parentType->name),
            $this->fieldKey,
            strtolower($this->resolveInfo->fieldName),
            $argKeys->isNotEmpty()
                ? $argKeys->implode(':')
                : null,
        ]);
    }
1116169
public function key()
    {
        $key = null;
        if (count($this->_names) > 0) {
            $names = array_flip($this->_names);
            $key = $names[$this->_position];
        }
        return $key;

    }
1152509
protected function getOtherKey()
    {
        if ($this->otherKey) {
            return $this->otherKey;
        }

        if (is_callable([$this->form->model(), $this->column]) &&
            ($relation = $this->form->model()->{$this->column}()) instanceof BelongsToMany
        ) {
            /* @var BelongsToMany $relation */
            $fullKey = $relation->getQualifiedRelatedPivotKeyName();
            $fullKeyArray = explode('.', $fullKey);

            return $this->otherKey = end($fullKeyArray);
        }

        throw new \Exception('Column of this field must be a `BelongsToMany` relation.');
    }
972292
public function key()
    {
        return isset( $this->packageNames[$this->index] )
            ? $this->packageNames[$this->index]
            : null;
    }
495117
public function field($name)
    {
        if (!isset($this->keyMap[$name])) {
            throw new Exception(sprintf('Unable to find %s named field.', $name));
        }
        return $this->controls[$this->keyMap[$name]];
    }
195566
protected function getFields()
    {
        if (is_null($this->fields)) {
            $columns = $this->getColumns();

            if (empty($columns)) {
                throw new Exception('The table ' . $this->tableName . ' was not found in the ' . $this->databaseName . ' database.');
            }

            $this->fields = $this->transfer($columns);
        }

        return $this->fields;
    }