public function getTableColumns($table, $typeOnly = true)
	{
		$columns = array();

		$fieldCasing = $this->connection->getAttribute(\PDO::ATTR_CASE);

		$this->connection->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_UPPER);

		$table = strtoupper($table);

		$this->setQuery('pragma table_info(' . $table . ')');
		$fields = $this->loadObjectList();

		if ($typeOnly)
		{
			foreach ($fields as $field)
			{
				$columns[$field->NAME] = $field->TYPE;
			}
		}
		else
		{
			foreach ($fields as $field)
			{
				// Normalize output
				$columns[$field->NAME] = (object) array(
					'Field'   => $field->NAME,
					'Type'    => $field->TYPE,
					'Null'    => ($field->NOTNULL == '1' ? 'NO' : 'YES'),
					'Default' => $field->DFLT_VALUE,
					'Key'     => ($field->PK != '0' ? 'PRI' : '')
				);
			}
		}

		$this->connection->setAttribute(\PDO::ATTR_CASE, $fieldCasing);

		return $columns;
	}
public function getTableColumns($table, $typeOnly = true)
	{
		$columns = array();

		$fieldCasing = $this->connection->getAttribute(\PDO::ATTR_CASE);

		$this->connection->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_UPPER);

		$table = strtoupper($table);

		$this->setQuery('pragma table_info(' . $table . ')');
		$fields = $this->loadObjectList();

		if ($typeOnly)
		{
			foreach ($fields as $field)
			{
				$columns[$field->NAME] = $field->TYPE;
			}
		}
		else
		{
			foreach ($fields as $field)
			{
				// Normalize output
				$columns[$field->NAME] = (object) array(
					'Field'   => $field->NAME,
					'Type'    => $field->TYPE,
					'Null'    => ($field->NOTNULL == '1' ? 'NO' : 'YES'),
					'Default' => $field->DFLT_VALUE,
					'Key'     => ($field->PK != '0' ? 'PRI' : '')
				);
			}
		}

		$this->connection->setAttribute(\PDO::ATTR_CASE, $fieldCasing);

		return $columns;
	}
public function getTableColumns ( $ table , $ typeOnly = true ) { $ columns = array ( ) ; $ fieldCasing = $ this -> connection -> getAttribute ( \ PDO :: ATTR_CASE ) ; $ this -> connection -> setAttribute ( \ PDO :: ATTR_CASE , \ PDO :: CASE_UPPER ) ; $ table = strtoupper ( $ table ) ; $ this -> setQuery ( 'pragma table_info(' . $ table . ')' ) ; $ fields = $ this -> loadObjectList ( ) ; if ( $ typeOnly ) { foreach ( $ fields as $ field ) { $ columns [ $ field -> NAME ] = $ field -> TYPE ; } } else { foreach ( $ fields as $ field ) { // Normalize output $ columns [ $ field -> NAME ] = ( object ) array ( 'Field' => $ field -> NAME , 'Type' => $ field -> TYPE , 'Null' => ( $ field -> NOTNULL == '1' ? 'NO' : 'YES' ) , 'Default' => $ field -> DFLT_VALUE , 'Key' => ( $ field -> PK != '0' ? 'PRI' : '' ) ) ; } } $ this -> connection -> setAttribute ( \ PDO :: ATTR_CASE , $ fieldCasing ) ; return $ columns ; }
Retrieves field information about the given table

@param   string   $table     The name of the database table.
@param   boolean  $typeOnly  True to only return field types.
@return  array    An array of fields for the database table.
@since   2.2.15
Retrieves field information about the given table