/**
  * Converts a XML description of a SQL index into a full SQL type
  *
  *	<index name="PRIMARY" type="primary">
  *		<column name="id"	/>
  *	</index>
  *	<index name="rate_chars">
  *		<column name="rate" />
  *		<column name="_mychars" nametype="namesuffix" size="8" ordering="DESC" />
  *	</index>
  *	<index name="myrate" type="unique" using="btree">
  *		<column name="rate" />
  *	</index>
  *
  * Returns: $fulltype: 'decimal(16,8) unsigned NULL DEFAULT NULL'
  * @access private
  *
  * @param  CBSimpleXMLElement  $index
  * @param  string              $colNamePrefix    Prefix to add to all column names
  * @return string|boolean                        Full SQL creation type or NULL in case of no index/error
  */
 function _fullIndexType(&$index, $colNamePrefix)
 {
     $sqlIndexText = null;
     if ($index->name() == 'index') {
         // first collect all columns of this index:
         $indexColumns = array();
         foreach ($index->children() as $column) {
             if ($column->name() == 'column') {
                 $colNamePrefixed = $this->_prefixedName($column, $colNamePrefix);
                 $indexColText = $this->_db->NameQuote($colNamePrefixed);
                 if ($column->attributes('size')) {
                     $indexColText .= ' (' . (int) $column->attributes('size') . ')';
                 }
                 if ($column->attributes('ordering')) {
                     $indexColText .= ' ' . $this->_db->getEscaped($column->attributes('ordering'));
                 }
                 $indexColumns[] = $indexColText;
             }
         }
         if (count($indexColumns) > 0) {
             // then build the index creation SQL:
             if ($index->attributes('type')) {
                 // PRIMARY, UNIQUE, FULLTEXT, SPATIAL:
                 $sqlIndexText .= $this->_db->getEscaped(strtoupper($index->attributes('type'))) . ' ';
             }
             $sqlIndexText .= 'KEY ';
             if ($index->attributes('type') !== 'primary') {
                 $sqlIndexText .= $this->_db->NameQuote($this->_prefixedName($index, $colNamePrefix)) . ' ';
             }
             if ($index->attributes('using')) {
                 // BTREE, HASH, RTREE:
                 $sqlIndexText .= 'USING ' . $this->_db->getEscaped($index->attributes('using')) . ' ';
             }
             $sqlIndexText .= '(' . implode(', ', $indexColumns) . ')';
         }
     }
     return $sqlIndexText;
 }