src/Mysql/MysqlImporter.php
protected function getKeySql($columns)
	{
		// TODO Error checking on array and element types.

		$kNonUnique = (string) $columns[0]['Non_unique'];
		$kName      = (string) $columns[0]['Key_name'];
		$kColumn    = (string) $columns[0]['Column_name'];

		$prefix = '';

		if ($kName === 'PRIMARY')
		{
			$prefix = 'PRIMARY ';
		}
		elseif ($kNonUnique == 0)
		{
			$prefix = 'UNIQUE ';
		}

		$nColumns = \count($columns);
		$kColumns = array();

		if ($nColumns === 1)
		{
			$kColumns[] = $this->db->quoteName($kColumn);
		}
		else
		{
			foreach ($columns as $column)
			{
				$kColumns[] = (string) $column['Column_name'];
			}
		}

		$sql = $prefix . 'KEY ' . ($kName !== 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';

		return $sql;
	}
protected function getKeySql($columns)
	{
		// TODO Error checking on array and element types.

		$kNonUnique = (string) $columns[0]['Non_unique'];
		$kName      = (string) $columns[0]['Key_name'];
		$kColumn    = (string) $columns[0]['Column_name'];

		$prefix = '';

		if ($kName === 'PRIMARY')
		{
			$prefix = 'PRIMARY ';
		}
		elseif ($kNonUnique == 0)
		{
			$prefix = 'UNIQUE ';
		}

		$nColumns = \count($columns);
		$kColumns = array();

		if ($nColumns === 1)
		{
			$kColumns[] = $this->db->quoteName($kColumn);
		}
		else
		{
			foreach ($columns as $column)
			{
				$kColumns[] = (string) $column['Column_name'];
			}
		}

		$sql = $prefix . 'KEY ' . ($kName !== 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';

		return $sql;
	}
protected function getKeySql ( $ columns ) { // TODO Error checking on array and element types. $ kNonUnique = ( string ) $ columns [ 0 ] [ 'Non_unique' ] ; $ kName = ( string ) $ columns [ 0 ] [ 'Key_name' ] ; $ kColumn = ( string ) $ columns [ 0 ] [ 'Column_name' ] ; $ prefix = '' ; if ( $ kName === 'PRIMARY' ) { $ prefix = 'PRIMARY ' ; } elseif ( $ kNonUnique == 0 ) { $ prefix = 'UNIQUE ' ; } $ nColumns = \ count ( $ columns ) ; $ kColumns = array ( ) ; if ( $ nColumns === 1 ) { $ kColumns [ ] = $ this -> db -> quoteName ( $ kColumn ) ; } else { foreach ( $ columns as $ column ) { $ kColumns [ ] = ( string ) $ column [ 'Column_name' ] ; } } $ sql = $ prefix . 'KEY ' . ( $ kName !== 'PRIMARY' ? $ this -> db -> quoteName ( $ kName ) : '' ) . ' (' . implode ( ',' , $ kColumns ) . ')' ; return $ sql ; }
Get the SQL syntax for a key.

@param   array  $columns  An array of SimpleXMLElement objects comprising the key.

@return  string

@since   1.0
Get the SQL syntax for a key .