Ejemplo n.º 1
0
        // Based on the required sorting and candidate columns settings, create a new index; Should be called only when there is no existing index to be reused
        private void CreateIndex() {
            if (index == null) {
                if (nCandidates == 0) {
                    index = new Index(table, IndexFields, recordStates, null);
                    index.AddRef();
                }
                else {
                    int i;
                    int lenCanColumns = candidateColumns.Length;
                    int lenIndexDesc = IndexFields.Length;
                    bool equalsOperator = true;
                    for (i=0; i<lenCanColumns; i++) {
                        if (candidateColumns[i] != null) {
                            if (!candidateColumns[i].equalsOperator) {
                                equalsOperator = false;
                                break;
                            }
                        }
                    }

                    int j=0;
                    for (i=0; i < lenIndexDesc; i++) {
                        ColumnInfo candidateColumn = candidateColumns[IndexFields[i].Column.Ordinal];
                        if (candidateColumn != null) {
                            candidateColumn.flag = true;
                            j++;
                        }
                    }
                    int indexNotInCandidates = lenIndexDesc - j;
                    int candidatesNotInIndex = nCandidates - j;
                    IndexField[] ndxFields = new IndexField[nCandidates + indexNotInCandidates];

                    if (equalsOperator) {
                        j=0;
                        for (i=0; i<lenCanColumns; i++) {
                            if (candidateColumns[i] != null) {
                                ndxFields[j++] = new IndexField(this.table.Columns[i], isDescending: false);
                                candidateColumns[i].flag = false;// this means it is processed
                            }
                        }
                        for (i=0; i<lenIndexDesc; i++) {
                            ColumnInfo canColumn = candidateColumns[IndexFields[i].Column.Ordinal];
                            if (canColumn == null || canColumn.flag) { // if sort column is not a filter col , or not processed
                                ndxFields[j++] = IndexFields[i];
                                if (canColumn != null) {
                                    canColumn.flag = false;
                                }
                            }                                
                        }

                        for(i = 0; i < candidateColumns.Length; i++) {
                            if (candidateColumns[i] != null) {
                                candidateColumns[i].flag = false;// same as before, it is false when it returns 
                            }
                            
                        }

                        // Debug.Assert(j == candidatesNotInIndex, "Whole ndxDesc should be filled!");

                        index = new Index(table, ndxFields, recordStates, null);
                        if (!IsOperatorIn(this.expression)) {
                            // if the expression contains an 'IN' operator, the index will not be shared
                            // therefore we do not need to index.AddRef, also table would track index consuming more memory until first write
                            index.AddRef();
                        }


                        matchedCandidates = nCandidates;
                     }
                     else {
                        for (i=0; i<lenIndexDesc; i++) {
                            ndxFields[i] = IndexFields[i];
                            ColumnInfo canColumn = candidateColumns[IndexFields[i].Column.Ordinal];
                            if (canColumn != null)
                                canColumn.flag = true;
                        }
                         j=i;
                        for (i=0; i<lenCanColumns; i++) {
                            if (candidateColumns[i] != null) {
                                if(!candidateColumns[i].flag) {
                                    ndxFields[j++] = new IndexField(this.table.Columns[i], isDescending: false);
                                }
                                else {
                                    candidateColumns[i].flag = false;
                                }
                            }
                        }
//                        Debug.Assert(j == nCandidates+indexNotInCandidates, "Whole ndxDesc should be filled!");
                                                
                        index = new Index(table, ndxFields, recordStates, null);
                        matchedCandidates = 0;
                        if (this.linearExpression != this.expression) {
                            IndexField[] fields = index.IndexFields;
                            while (matchedCandidates < j) { // [....] : j = index.IndexDesc.Length
                                ColumnInfo canColumn = candidateColumns[fields[matchedCandidates].Column.Ordinal];
                                if (canColumn == null || canColumn.expr == null)
                                    break;
                                matchedCandidates++;
                                if (!canColumn.equalsOperator)
                                    break;
                            }
                        }
                        for(i = 0; i < candidateColumns.Length; i++) {
                            if (candidateColumns[i] != null) {
                                candidateColumns[i].flag = false;// same as before, it is false when it returns 
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 internal string FormatSortString(IndexField[] indexDesc) {
     StringBuilder builder = new StringBuilder();
     foreach (IndexField field in indexDesc) {
         if (0 < builder.Length) {
             builder.Append(", ");
         }
         builder.Append(field.Column.ColumnName);
         if (field.IsDescending) {
             builder.Append(" DESC");
         }
     }
     return builder.ToString();
 }
Ejemplo n.º 3
0
 private bool CompareSortIndexDesc(IndexField[] fields) {
     if (fields.Length < IndexFields.Length)
         return false;
     int j=0;
     for (int i = 0; i < fields.Length && j < IndexFields.Length; i++) {
         if (fields[i] == IndexFields[j]) {
             j++;
         }
         else {
             ColumnInfo canColumn = candidateColumns[fields[i].Column.Ordinal];
             if (!(canColumn != null && canColumn.equalsOperator))
                 return false;
         }
     }
     return j == IndexFields.Length;
 }
Ejemplo n.º 4
0
 // Returns no. of columns that are matched
 private int CompareClosestCandidateIndexDesc(IndexField[] fields) {
     int count = (fields.Length < nCandidates ? fields.Length : nCandidates);
     int i = 0;
     for (; i < count; i++) {
         ColumnInfo canColumn = candidateColumns[fields[i].Column.Ordinal];
         if (canColumn == null || canColumn.expr == null) {
             break;
         }
         else
         if (!canColumn.equalsOperator) {
             return i+1;
         }
     }
     return i;
 }
 internal Index GetIndex(IndexField[] indexDesc)
 {
     return this.GetIndex(indexDesc, DataViewRowState.CurrentRows, null);
 }
Ejemplo n.º 6
0
 internal IndexField[] GetIndexDesc()
 {
     IndexField[] indexDesc = new IndexField[_columns.Length];
     for (int i = 0; i < _columns.Length; i++)
     {
         indexDesc[i] = new IndexField(_columns[i], false);
     }
     return indexDesc;
 }
 internal static int[] ConvertIndexFieldtoIndexDesc(IndexField[] fields)
 {
     int[] numArray = new int[fields.Length];
     for (int i = 0; i < fields.Length; i++)
     {
         numArray[i] = fields[i].Column.Ordinal | (fields[i].IsDescending ? -2147483648 : 0);
     }
     return numArray;
 }
Ejemplo n.º 8
0
 private IndexField [] NewIndexDesc(DataKey key) {
     Debug.Assert(key.HasValue);
     IndexField[] indexDesc = key.GetIndexDesc();
     IndexField[] newIndexDesc = new IndexField[indexDesc.Length];
     Array.Copy(indexDesc, 0, newIndexDesc, 0, indexDesc.Length);
     return newIndexDesc;
 }
Ejemplo n.º 9
0
 internal Index GetIndex(IndexField[] indexDesc, DataViewRowState recordStates, IFilter rowFilter)
 {
     _indexesLock.EnterUpgradeableReadLock();
     try
     {
         for (int i = 0; i < _indexes.Count; i++)
         {
             Index index = _indexes[i];
             if (index != null)
             {
                 if (index.Equal(indexDesc, recordStates, rowFilter))
                 {
                     return index;
                 }
             }
         }
     }
     finally
     {
         _indexesLock.ExitUpgradeableReadLock();
     }
     Index ndx = new Index(this, indexDesc, recordStates, rowFilter);
     ndx.AddRef();
     return ndx;
 }
Ejemplo n.º 10
0
 private void CreateIndex()
 {
     if (this.index == null)
     {
         if (this.nCandidates == 0)
         {
             this.index = new Index(this.table, this.IndexFields, this.recordStates, null);
             this.index.AddRef();
         }
         else
         {
             int  num;
             int  length = this.candidateColumns.Length;
             int  num5   = this.indexDesc.Length;
             bool flag   = true;
             for (num = 0; num < length; num++)
             {
                 if ((this.candidateColumns[num] != null) && !this.candidateColumns[num].equalsOperator)
                 {
                     flag = false;
                     break;
                 }
             }
             int num2 = 0;
             for (num = 0; num < num5; num++)
             {
                 ColumnInfo info4 = this.candidateColumns[DataKey.ColumnOrder(this.indexDesc[num])];
                 if (info4 != null)
                 {
                     info4.flag = true;
                     num2++;
                 }
             }
             int   num7     = num5 - num2;
             int[] ndexDesc = new int[this.nCandidates + num7];
             if (flag)
             {
                 num2 = 0;
                 for (num = 0; num < length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         ndexDesc[num2++] = num;
                         this.candidateColumns[num].flag = false;
                     }
                 }
                 for (num = 0; num < num5; num++)
                 {
                     ColumnInfo info = this.candidateColumns[DataKey.ColumnOrder(this.indexDesc[num])];
                     if ((info == null) || info.flag)
                     {
                         ndexDesc[num2++] = this.indexDesc[num];
                         if (info != null)
                         {
                             info.flag = false;
                         }
                     }
                 }
                 for (num = 0; num < this.candidateColumns.Length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         this.candidateColumns[num].flag = false;
                     }
                 }
                 IndexField[] zeroIndexField = DataTable.zeroIndexField;
                 if (0 < ndexDesc.Length)
                 {
                     zeroIndexField = new IndexField[ndexDesc.Length];
                     for (int i = 0; i < ndexDesc.Length; i++)
                     {
                         DataColumn column2      = this.table.Columns[DataKey.ColumnOrder(ndexDesc[i])];
                         bool       isDescending = DataKey.SortDecending(ndexDesc[i]);
                         zeroIndexField[i] = new IndexField(column2, isDescending);
                     }
                 }
                 this.index = new Index(this.table, ndexDesc, zeroIndexField, this.recordStates, null);
                 if (!this.IsOperatorIn(this.expression))
                 {
                     this.index.AddRef();
                 }
                 this.matchedCandidates = this.nCandidates;
             }
             else
             {
                 num = 0;
                 while (num < num5)
                 {
                     ndexDesc[num] = this.indexDesc[num];
                     ColumnInfo info3 = this.candidateColumns[DataKey.ColumnOrder(this.indexDesc[num])];
                     if (info3 != null)
                     {
                         info3.flag = true;
                     }
                     num++;
                 }
                 num2 = num;
                 for (num = 0; num < length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         if (!this.candidateColumns[num].flag)
                         {
                             ndexDesc[num2++] = num;
                         }
                         else
                         {
                             this.candidateColumns[num].flag = false;
                         }
                     }
                 }
                 IndexField[] indexFields = DataTable.zeroIndexField;
                 if (0 < ndexDesc.Length)
                 {
                     indexFields = new IndexField[ndexDesc.Length];
                     for (int j = 0; j < ndexDesc.Length; j++)
                     {
                         DataColumn column = this.table.Columns[DataKey.ColumnOrder(ndexDesc[j])];
                         bool       flag2  = DataKey.SortDecending(ndexDesc[j]);
                         indexFields[j] = new IndexField(column, flag2);
                     }
                 }
                 this.index             = new Index(this.table, ndexDesc, indexFields, this.recordStates, null);
                 this.matchedCandidates = 0;
                 if (this.linearExpression != this.expression)
                 {
                     int[] indexDesc = this.index.IndexDesc;
                     while (this.matchedCandidates < num2)
                     {
                         ColumnInfo info2 = this.candidateColumns[DataKey.ColumnOrder(indexDesc[this.matchedCandidates])];
                         if ((info2 == null) || (info2.expr == null))
                         {
                             break;
                         }
                         this.matchedCandidates++;
                         if (!info2.equalsOperator)
                         {
                             break;
                         }
                     }
                 }
                 for (num = 0; num < this.candidateColumns.Length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         this.candidateColumns[num].flag = false;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
 internal Index GetIndex(IndexField[] indexDesc) =>
     GetIndex(indexDesc, DataViewRowState.CurrentRows, null);
 internal IndexField[] ParseSortString(string sortString)
 {
     IndexField[] zeroIndexField = DataTable.zeroIndexField;
     if ((sortString != null) && (0 < sortString.Length))
     {
         string[] strArray = sortString.Split(new char[] { ',' });
         zeroIndexField = new IndexField[strArray.Length];
         for (int i = 0; i < strArray.Length; i++)
         {
             string strA = strArray[i].Trim();
             int length = strA.Length;
             bool isDescending = false;
             if ((length >= 5) && (string.Compare(strA, length - 4, " ASC", 0, 4, StringComparison.OrdinalIgnoreCase) == 0))
             {
                 strA = strA.Substring(0, length - 4).Trim();
             }
             else if ((length >= 6) && (string.Compare(strA, length - 5, " DESC", 0, 5, StringComparison.OrdinalIgnoreCase) == 0))
             {
                 isDescending = true;
                 strA = strA.Substring(0, length - 5).Trim();
             }
             if (strA.StartsWith("[", StringComparison.Ordinal))
             {
                 if (!strA.EndsWith("]", StringComparison.Ordinal))
                 {
                     throw ExceptionBuilder.InvalidSortString(strArray[i]);
                 }
                 strA = strA.Substring(1, strA.Length - 2);
             }
             DataColumn column = this.Columns[strA];
             if (column == null)
             {
                 throw ExceptionBuilder.ColumnOutOfRange(strA);
             }
             zeroIndexField[i] = new IndexField(column, isDescending);
         }
     }
     return zeroIndexField;
 }
 private IndexField[] NewIndexDesc(DataKey key)
 {
     IndexField[] indexDesc = key.GetIndexDesc();
     IndexField[] destinationArray = new IndexField[indexDesc.Length];
     Array.Copy(indexDesc, 0, destinationArray, 0, indexDesc.Length);
     return destinationArray;
 }
Ejemplo n.º 14
0
 internal Index GetIndex(IndexField[] indexDesc) {
     return GetIndex(indexDesc, DataViewRowState.CurrentRows, (IFilter)null);
 }
 private void CreateIndex()
 {
     if (this.index == null)
     {
         if (this.nCandidates == 0)
         {
             this.index = new Index(this.table, this.IndexFields, this.recordStates, null);
             this.index.AddRef();
         }
         else
         {
             int num;
             int length = this.candidateColumns.Length;
             int num5 = this.indexDesc.Length;
             bool flag = true;
             for (num = 0; num < length; num++)
             {
                 if ((this.candidateColumns[num] != null) && !this.candidateColumns[num].equalsOperator)
                 {
                     flag = false;
                     break;
                 }
             }
             int num2 = 0;
             for (num = 0; num < num5; num++)
             {
                 ColumnInfo info4 = this.candidateColumns[DataKey.ColumnOrder(this.indexDesc[num])];
                 if (info4 != null)
                 {
                     info4.flag = true;
                     num2++;
                 }
             }
             int num7 = num5 - num2;
             int[] ndexDesc = new int[this.nCandidates + num7];
             if (flag)
             {
                 num2 = 0;
                 for (num = 0; num < length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         ndexDesc[num2++] = num;
                         this.candidateColumns[num].flag = false;
                     }
                 }
                 for (num = 0; num < num5; num++)
                 {
                     ColumnInfo info = this.candidateColumns[DataKey.ColumnOrder(this.indexDesc[num])];
                     if ((info == null) || info.flag)
                     {
                         ndexDesc[num2++] = this.indexDesc[num];
                         if (info != null)
                         {
                             info.flag = false;
                         }
                     }
                 }
                 for (num = 0; num < this.candidateColumns.Length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         this.candidateColumns[num].flag = false;
                     }
                 }
                 IndexField[] zeroIndexField = DataTable.zeroIndexField;
                 if (0 < ndexDesc.Length)
                 {
                     zeroIndexField = new IndexField[ndexDesc.Length];
                     for (int i = 0; i < ndexDesc.Length; i++)
                     {
                         DataColumn column2 = this.table.Columns[DataKey.ColumnOrder(ndexDesc[i])];
                         bool isDescending = DataKey.SortDecending(ndexDesc[i]);
                         zeroIndexField[i] = new IndexField(column2, isDescending);
                     }
                 }
                 this.index = new Index(this.table, ndexDesc, zeroIndexField, this.recordStates, null);
                 if (!this.IsOperatorIn(this.expression))
                 {
                     this.index.AddRef();
                 }
                 this.matchedCandidates = this.nCandidates;
             }
             else
             {
                 num = 0;
                 while (num < num5)
                 {
                     ndexDesc[num] = this.indexDesc[num];
                     ColumnInfo info3 = this.candidateColumns[DataKey.ColumnOrder(this.indexDesc[num])];
                     if (info3 != null)
                     {
                         info3.flag = true;
                     }
                     num++;
                 }
                 num2 = num;
                 for (num = 0; num < length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         if (!this.candidateColumns[num].flag)
                         {
                             ndexDesc[num2++] = num;
                         }
                         else
                         {
                             this.candidateColumns[num].flag = false;
                         }
                     }
                 }
                 IndexField[] indexFields = DataTable.zeroIndexField;
                 if (0 < ndexDesc.Length)
                 {
                     indexFields = new IndexField[ndexDesc.Length];
                     for (int j = 0; j < ndexDesc.Length; j++)
                     {
                         DataColumn column = this.table.Columns[DataKey.ColumnOrder(ndexDesc[j])];
                         bool flag2 = DataKey.SortDecending(ndexDesc[j]);
                         indexFields[j] = new IndexField(column, flag2);
                     }
                 }
                 this.index = new Index(this.table, ndexDesc, indexFields, this.recordStates, null);
                 this.matchedCandidates = 0;
                 if (this.linearExpression != this.expression)
                 {
                     int[] indexDesc = this.index.IndexDesc;
                     while (this.matchedCandidates < num2)
                     {
                         ColumnInfo info2 = this.candidateColumns[DataKey.ColumnOrder(indexDesc[this.matchedCandidates])];
                         if ((info2 == null) || (info2.expr == null))
                         {
                             break;
                         }
                         this.matchedCandidates++;
                         if (!info2.equalsOperator)
                         {
                             break;
                         }
                     }
                 }
                 for (num = 0; num < this.candidateColumns.Length; num++)
                 {
                     if (this.candidateColumns[num] != null)
                     {
                         this.candidateColumns[num].flag = false;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 16
0
 internal Index GetIndex(IndexField[] indexDesc, DataViewRowState recordStates, IFilter rowFilter) {
     indexesLock.AcquireReaderLock(-1);
     try {
         for (int i = 0; i < indexes.Count; i++) {
             Index index = indexes[i];
             if (index != null) {
                 if (index.Equal(indexDesc, recordStates, rowFilter)) {
                     return index;
                 }
             }
         }
     }
     finally {
         indexesLock.ReleaseReaderLock();
     }
     Index ndx = new Index(this, indexDesc, recordStates, rowFilter);
     ndx.AddRef();
     return ndx;
 }
Ejemplo n.º 17
0
        // Based on the required sorting and candidate columns settings, create a new index; Should be called only when there is no existing index to be reused
        private void CreateIndex()
        {
            if (_index == null)
            {
                if (_nCandidates == 0)
                {
                    _index = new Index(_table, _indexFields, _recordStates, null);
                    _index.AddRef();
                }
                else
                {
                    int  i;
                    int  lenCanColumns  = _candidateColumns.Length;
                    int  lenIndexDesc   = _indexFields.Length;
                    bool equalsOperator = true;
                    for (i = 0; i < lenCanColumns; i++)
                    {
                        if (_candidateColumns[i] != null)
                        {
                            if (!_candidateColumns[i].equalsOperator)
                            {
                                equalsOperator = false;
                                break;
                            }
                        }
                    }

                    int j = 0;
                    for (i = 0; i < lenIndexDesc; i++)
                    {
                        ColumnInfo candidateColumn = _candidateColumns[_indexFields[i].Column.Ordinal];
                        if (candidateColumn != null)
                        {
                            candidateColumn.flag = true;
                            j++;
                        }
                    }
                    int          indexNotInCandidates = lenIndexDesc - j;
                    IndexField[] ndxFields            = new IndexField[_nCandidates + indexNotInCandidates];

                    if (equalsOperator)
                    {
                        j = 0;
                        for (i = 0; i < lenCanColumns; i++)
                        {
                            if (_candidateColumns[i] != null)
                            {
                                ndxFields[j++]            = new IndexField(_table.Columns[i], isDescending: false);
                                _candidateColumns[i].flag = false;// this means it is processed
                            }
                        }
                        for (i = 0; i < lenIndexDesc; i++)
                        {
                            ColumnInfo canColumn = _candidateColumns[_indexFields[i].Column.Ordinal];
                            if (canColumn == null || canColumn.flag)
                            { // if sort column is not a filter col , or not processed
                                ndxFields[j++] = _indexFields[i];
                                if (canColumn != null)
                                {
                                    canColumn.flag = false;
                                }
                            }
                        }

                        for (i = 0; i < _candidateColumns.Length; i++)
                        {
                            if (_candidateColumns[i] != null)
                            {
                                _candidateColumns[i].flag = false;// same as before, it is false when it returns
                            }
                        }

                        // Debug.Assert(j == candidatesNotInIndex, "Whole ndxDesc should be filled!");

                        _index = new Index(_table, ndxFields, _recordStates, null);
                        if (!IsOperatorIn(_expression))
                        {
                            // if the expression contains an 'IN' operator, the index will not be shared
                            // therefore we do not need to index.AddRef, also table would track index consuming more memory until first write
                            _index.AddRef();
                        }


                        _matchedCandidates = _nCandidates;
                    }
                    else
                    {
                        for (i = 0; i < lenIndexDesc; i++)
                        {
                            ndxFields[i] = _indexFields[i];
                            ColumnInfo canColumn = _candidateColumns[_indexFields[i].Column.Ordinal];
                            if (canColumn != null)
                            {
                                canColumn.flag = true;
                            }
                        }
                        j = i;
                        for (i = 0; i < lenCanColumns; i++)
                        {
                            if (_candidateColumns[i] != null)
                            {
                                if (!_candidateColumns[i].flag)
                                {
                                    ndxFields[j++] = new IndexField(_table.Columns[i], isDescending: false);
                                }
                                else
                                {
                                    _candidateColumns[i].flag = false;
                                }
                            }
                        }
                        //                        Debug.Assert(j == nCandidates+indexNotInCandidates, "Whole ndxDesc should be filled!");

                        _index             = new Index(_table, ndxFields, _recordStates, null);
                        _matchedCandidates = 0;
                        if (_linearExpression != _expression)
                        {
                            IndexField[] fields = _index._indexFields;
                            while (_matchedCandidates < j)
                            {
                                ColumnInfo canColumn = _candidateColumns[fields[_matchedCandidates].Column.Ordinal];
                                if (canColumn == null || canColumn.expr == null)
                                {
                                    break;
                                }
                                _matchedCandidates++;
                                if (!canColumn.equalsOperator)
                                {
                                    break;
                                }
                            }
                        }
                        for (i = 0; i < _candidateColumns.Length; i++)
                        {
                            if (_candidateColumns[i] != null)
                            {
                                _candidateColumns[i].flag = false;// same as before, it is false when it returns
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
0
        internal IndexField[] ParseSortString(string sortString) {
            IndexField[] indexDesc = zeroIndexField;
            if ((null != sortString) && (0 < sortString.Length)) {
                string[] split = sortString.Split(new char[] { ','});
                indexDesc = new IndexField[split.Length];

                for (int i = 0; i < split.Length; i++) {
                    string current = split[i].Trim();

                    // handle ASC and DESC.
                    int length = current.Length;
                    bool descending = false;
                    if (length >= 5 && String.Compare(current, length - 4, " ASC", 0, 4, StringComparison.OrdinalIgnoreCase) == 0) {
                        current = current.Substring(0, length - 4).Trim();
                    }
                    else if (length >= 6 && String.Compare(current, length - 5, " DESC", 0, 5, StringComparison.OrdinalIgnoreCase) == 0) {
                        descending = true;
                        current = current.Substring(0, length - 5).Trim();
                    }

                    // handle brackets.
                    if (current.StartsWith("[", StringComparison.Ordinal)) {
                        if (current.EndsWith("]", StringComparison.Ordinal)) {
                            current = current.Substring(1, current.Length - 2);
                        }
                        else {
                            throw ExceptionBuilder.InvalidSortString(split[i]);
                        }
                    }

                    // find the column.
                    DataColumn column = Columns[current];
                    if(column == null) {
                        throw ExceptionBuilder.ColumnOutOfRange(current);
                    }
                    indexDesc[i] = new IndexField(column, descending);
                }
            }
            return indexDesc;
        }
 internal IndexField[] GetIndexDesc()
 {
     IndexField[] fieldArray = new IndexField[this.columns.Length];
     for (int i = 0; i < this.columns.Length; i++)
     {
         fieldArray[i] = new IndexField(this.columns[i], false);
     }
     return fieldArray;
 }