Ejemplo n.º 1
0
        public virtual void TryEvaluate(Partition partition, ShortSet result, ExecutionDetails details)
        {
            if (details == null)
            {
                throw new ArgumentNullException("details");
            }
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            if (partition == null)
            {
                throw new ArgumentNullException("partition");
            }

            if (this.ColumnName.Equals("*"))
            {
                // '*' queries succeed if any column succeeds
                bool             succeeded        = false;
                ExecutionDetails perColumnDetails = new ExecutionDetails();

                foreach (IColumn <object> column in partition.Columns.Values)
                {
                    perColumnDetails.Succeeded = true;
                    column.TryWhere(this.Operator, this.Value, result, perColumnDetails);
                    succeeded |= perColumnDetails.Succeeded;
                }

                details.Succeeded &= succeeded;

                // If no column succeeded, report the full errors
                if (!succeeded)
                {
                    details.Merge(perColumnDetails);
                }
            }
            else
            {
                if (!partition.ContainsColumn(this.ColumnName))
                {
                    details.AddError(ExecutionDetails.ColumnDoesNotExist, this.ColumnName);
                }
                else
                {
                    partition.Columns[this.ColumnName].TryWhere(this.Operator, this.Value, result, details);
                }
            }
        }
Ejemplo n.º 2
0
        public override void TryEvaluate(Partition partition, ShortSet result, ExecutionDetails details)
        {
            if (details == null)
            {
                throw new ArgumentNullException("details");
            }
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            if (partition == null)
            {
                throw new ArgumentNullException("partition");
            }

            // Run on every column *except* excluded ones
            bool             succeeded        = false;
            ExecutionDetails perColumnDetails = new ExecutionDetails();

            foreach (IColumn <object> column in partition.Columns.Values)
            {
                if (!this.RestrictedColumns.Contains(column.Name))
                {
                    perColumnDetails.Succeeded = true;
                    column.TryWhere(this.Operator, this.Value, result, perColumnDetails);
                    succeeded |= perColumnDetails.Succeeded;
                }
            }

            details.Succeeded &= succeeded;

            // If no column succeeded, report the full errors
            if (!succeeded)
            {
                details.Merge(perColumnDetails);
            }
        }