Ejemplo n.º 1
0
        internal IValueManager _manager;         // Only used during the Add and Remove calls

        public bool CompareEqual(IValueManager manager, NativeRow indexKey, NativeRow compareKey)
        {
            // If AIndexKeyRowType is null, the index key must have the structure of an index key,
            // Otherwise, the IndexKey row could be a subset of the actual index key.
            // In that case, AIndexKeyRowType is the RowType for the IndexKey row.
            // It is the caller's responsibility to ensure that the passed IndexKey RowType
            // is a subset of the actual IndexKey with order intact.
            //Row LIndexKey = new Row(AManager, AIndexKeyRowType, AIndexKey);

            // If ACompareContext is null, the compare key must have the structure of an index key,
            // Otherwise the CompareKey could be a subset of the actual index key.
            // In that case, ACompareContext is the RowType for the CompareKey row.
            // It is the caller's responsibility to ensure that the passed CompareKey RowType
            // is a subset of the IndexKey with order intact.
            //Row LCompareKey = new Row(AManager, ACompareKeyRowType, ACompareKey);

            for (int index = 0; index < _keyRowType.Columns.Count; index++)
            {
                if (index >= compareKey.Values.Count())
                {
                    return(false);
                }

                if ((indexKey.Values[index] != null) && (compareKey.Values[index] != null))
                {
                    if (_keyRowType.Columns[index].DataType is Schema.ScalarType)
                    {
                        if (!manager.EvaluateEqualitySort(GetEqualitySort(Key.Columns[index].Name), indexKey.Values[index], compareKey.Values[index]))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        using (var indexValue = DataValue.FromNative(manager, indexKey.DataTypes[index], indexKey.Values[index]))
                        {
                            using (var compareValue = DataValue.FromNative(manager, compareKey.DataTypes[index], compareKey.Values[index]))
                            {
                                if (!manager.EvaluateEqualitySort(GetEqualitySort(Key.Columns[index].Name), indexValue, compareValue))
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                }
                else if (indexKey.Values[index] != null)
                {
                    return(false);
                }
                else if (compareKey.Values[index] != null)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        internal IValueManager _manager;         // Only used during the Add and Remove calls

        public bool CompareEqual(IValueManager manager, object index, object compare)
        {
            // If AIndexKeyRowType is null, the index key must have the structure of an index key,
            // Otherwise, the IndexKey row could be a subset of the actual index key.
            // In that case, AIndexKeyRowType is the RowType for the IndexKey row.
            // It is the caller's responsibility to ensure that the passed IndexKey RowType
            // is a subset of the actual IndexKey with order intact.
            //Row LIndexKey = new Row(AManager, AIndexKeyRowType, AIndexKey);

            // If ACompareContext is null, the compare key must have the structure of an index key,
            // Otherwise the CompareKey could be a subset of the actual index key.
            // In that case, ACompareContext is the RowType for the CompareKey row.
            // It is the caller's responsibility to ensure that the passed CompareKey RowType
            // is a subset of the IndexKey with order intact.
            //Row LCompareKey = new Row(AManager, ACompareKeyRowType, ACompareKey);

            return(manager.EvaluateEqualitySort(_equalitySort, index, compare));

            //using (var indexValue = DataValue.FromNative(manager, _listType.ElementType, index))
            //{
            //	using (var compareValue = DataValue.FromNative(manager, _listType.ElementType, compare))
            //	{
            //		return manager.EvaluateEqualitySort(_equalitySort, indexValue, compareValue);
            //	}
            //}
        }