public function getFieldNames(string $table)
	{
		// Is there a cached result?
		if (isset($this->dataCache['field_names'][$table]))
		{
			return $this->dataCache['field_names'][$table];
		}

		if (empty($this->connID))
		{
			$this->initialize();
		}

		if (false === ($sql = $this->_listColumns($table)))
		{
			if ($this->DBDebug)
			{
				throw new DatabaseException(lang('Database.featureUnavailable'));
			}

			return false;
		}

		$query                                  = $this->query($sql);
		$this->dataCache['field_names'][$table] = [];

		foreach ($query->getResultArray() as $row)
		{
			// Do we know from where to get the column's name?
			if (! isset($key))
			{
				if (isset($row['column_name']))
				{
					$key = 'column_name';
				}
				elseif (isset($row['COLUMN_NAME']))
				{
					$key = 'COLUMN_NAME';
				}
				elseif (isset($row['name']))
				{
					$key = 'name';
				}
				else
				{
					// We have no other choice but to just get the first element's key.
					$key = key($row);
				}
			}

			$this->dataCache['field_names'][$table][] = $row[$key];
		}

		return $this->dataCache['field_names'][$table];
	}
public function getFieldNames(string $table)
	{
		// Is there a cached result?
		if (isset($this->dataCache['field_names'][$table]))
		{
			return $this->dataCache['field_names'][$table];
		}

		if (empty($this->connID))
		{
			$this->initialize();
		}

		if (false === ($sql = $this->_listColumns($table)))
		{
			if ($this->DBDebug)
			{
				throw new DatabaseException(lang('Database.featureUnavailable'));
			}

			return false;
		}

		$query                                  = $this->query($sql);
		$this->dataCache['field_names'][$table] = [];

		foreach ($query->getResultArray() as $row)
		{
			// Do we know from where to get the column's name?
			if (! isset($key))
			{
				if (isset($row['column_name']))
				{
					$key = 'column_name';
				}
				elseif (isset($row['COLUMN_NAME']))
				{
					$key = 'COLUMN_NAME';
				}
				elseif (isset($row['name']))
				{
					$key = 'name';
				}
				else
				{
					// We have no other choice but to just get the first element's key.
					$key = key($row);
				}
			}

			$this->dataCache['field_names'][$table][] = $row[$key];
		}

		return $this->dataCache['field_names'][$table];
	}
public function getFieldNames ( string $ table ) { // Is there a cached result? if ( isset ( $ this -> dataCache [ 'field_names' ] [ $ table ] ) ) { return $ this -> dataCache [ 'field_names' ] [ $ table ] ; } if ( empty ( $ this -> connID ) ) { $ this -> initialize ( ) ; } if ( false === ( $ sql = $ this -> _listColumns ( $ table ) ) ) { if ( $ this -> DBDebug ) { throw new DatabaseException ( lang ( 'Database.featureUnavailable' ) ) ; } return false ; } $ query = $ this -> query ( $ sql ) ; $ this -> dataCache [ 'field_names' ] [ $ table ] = [ ] ; foreach ( $ query -> getResultArray ( ) as $ row ) { // Do we know from where to get the column's name? if ( ! isset ( $ key ) ) { if ( isset ( $ row [ 'column_name' ] ) ) { $ key = 'column_name' ; } elseif ( isset ( $ row [ 'COLUMN_NAME' ] ) ) { $ key = 'COLUMN_NAME' ; } elseif ( isset ( $ row [ 'name' ] ) ) { $ key = 'name' ; } else { // We have no other choice but to just get the first element's key. $ key = key ( $ row ) ; } } $ this -> dataCache [ 'field_names' ] [ $ table ] [ ] = $ row [ $ key ] ; } return $ this -> dataCache [ 'field_names' ] [ $ table ] ; }
Fetch Field Names

@param string $table Table name

@return array|false
@throws DatabaseException
Fetch Field Names