Beispiel #1
0
        public static string GetAggregateFuncationTag(AggregateFunctionType type)
        {
            switch (type)
            {
            case AggregateFunctionType.AVG:
                return(AVG);

            case AggregateFunctionType.COUNT:
                return(COUNT);

            case AggregateFunctionType.MAX:
                return(MAX);

            case AggregateFunctionType.MIN:
                return(MIN);

            case AggregateFunctionType.SUM:
                return(SUM);

            case AggregateFunctionType.FIRST:
                return(FIRST);

            case AggregateFunctionType.LAST:
                return(LAST);

            default:
                return(null);
            }
        }
 internal void SetResult(QueryContext queryContext, AggregateFunctionType functionType, object result)
 {
     QueryResultSet resultSet = new QueryResultSet();
     resultSet.Type = QueryType.AggregateFunction;
     resultSet.AggregateFunctionType = functionType;
     resultSet.AggregateFunctionResult = new DictionaryEntry(functionType, result);
     queryContext.ResultSet = resultSet;
 }
Beispiel #3
0
 void ICompactSerializable.Deserialize(Runtime.Serialization.IO.CompactReader reader)
 {
     _aggregateFunctionResult = (DictionaryEntry)reader.ReadObject();
     _searchKeysResult        = reader.ReadObject() as ArrayList;
     _searchEntriesResult     = reader.ReadObject() as Hashtable;
     _queryType             = (QueryType)reader.ReadInt32();
     _aggregateFunctionType = (AggregateFunctionType)reader.ReadInt32();
 }
Beispiel #4
0
        internal void SetResult(QueryContext queryContext, AggregateFunctionType functionType, object result)
        {
            QueryResultSet resultSet = new QueryResultSet();

            resultSet.Type = QueryType.AggregateFunction;
            resultSet.AggregateFunctionType   = functionType;
            resultSet.AggregateFunctionResult = new DictionaryEntry(functionType, result);
            queryContext.ResultSet            = resultSet;
        }
Beispiel #5
0
 /// <summary>
 /// Deserializa os dados na instancia.
 /// </summary>
 /// <param name="reader"></param>
 public virtual void Deserialize(CompactReader reader)
 {
     _aggregateFunctionResult = (DictionaryEntry)reader.ReadObject();
     _searchKeysResult        = reader.ReadObject() as ArrayList;
     _searchEntriesResult     = reader.ReadObject() as Hashtable;
     _queryType             = (QueryType)reader.ReadInt32();
     _aggregateFunctionType = (AggregateFunctionType)reader.ReadInt32();
     _cqId = reader.ReadString();
 }
Beispiel #6
0
 public void Deserialize(Runtime.Serialization.IO.CompactReader reader)
 {
     _columnName            = reader.ReadObject() as string;
     _columnType            = (ColumnType)reader.ReadInt32();
     _dataType              = (ColumnDataType)reader.ReadInt32();
     _aggregateFunctionType = (AggregateFunctionType)reader.ReadInt32();
     _isFilled              = reader.ReadBoolean();
     _isHidden              = reader.ReadBoolean();
 }
Beispiel #7
0
 void ICompactSerializable.Deserialize(Runtime.Serialization.IO.CompactReader reader)
 {
     _aggregateFunctionResult = (DictionaryEntry)reader.ReadObject();
     _searchKeysResult        = reader.ReadObject() as ClusteredArrayList;
     _searchEntriesResult     = reader.ReadObject() as IDictionary;
     _queryType             = (QueryType)reader.ReadInt32();
     _aggregateFunctionType = (AggregateFunctionType)reader.ReadInt32();
     _cqId = reader.ReadString();
     _groupByFunctionResult = reader.ReadObject() as RecordSet;
 }
 public AggregateFunction(AggregateFunctionType type, string condition)
 {
     if (!type.GetDisplayName().EndsWith("IF", StringComparison.OrdinalIgnoreCase))
     {
         throw new IncorrectTgOptionsException(
                   $"Cannot set condition property to {type.GetDisplayName()} function. " +
                   "Function must end with 'If' string, such as SumIf, CcountIf");
     }
     Type      = type;
     Condition = condition;
 }
Beispiel #9
0
 public static Identifier GetMethodName(AggregateFunctionType type)
 {
     switch (type)
     {
         case AggregateFunctionType.Avg:
             return Avg;
         case AggregateFunctionType.Max:
             return Max;
         case AggregateFunctionType.Min:
             return Min;
         case AggregateFunctionType.Sum:
             return Sum;
         case AggregateFunctionType.Count:
             return Count;
     }
     return null;
 }
Beispiel #10
0
        public DocumentCollector AddAggregateFunction(AggregateFunctionType type, IEvaluable field)
        {
            if (_aggregations == null)
            {
                _aggregations = new List <DocumentCollector>();
            }
            IAggregation function;

            switch (type)
            {
            case AggregateFunctionType.AVG:
                function = new AVG();
                break;

            case AggregateFunctionType.COUNT:
                function = new COUNT();
                break;

            case AggregateFunctionType.MAX:
                function = new MAX();
                break;

            case AggregateFunctionType.MIN:
                function = new MIN();
                break;

            case AggregateFunctionType.SUM:
                function = new SUM();
                break;

            //case AggregateFunctionType.FIRST:
            //    function = new FIRST(field);
            //    break;
            //case AggregateFunctionType.LAST:
            //    function = new LAST(field);
            //    break;
            default:
                throw new QuerySystemException(ErrorCodes.Query.AGGREGATION_INVALID_FUNCTION);
            }
            var aggregator = new DocumentCollector(function, field);

            _aggregations.Add(aggregator);
            return(aggregator);
        }
Beispiel #11
0
 public AggregateFunction(AggregateFunctionType aggregate_function_type, ISqlExpression expression)
 {
     _aggregateFunctionType = aggregate_function_type;
     _expression            = expression;
 }
Beispiel #12
0
        public Aggregate(AggregateFunctionType type, params Expression[] expression)
            : this(GetMethodName(type), expression)
        {

        }
Beispiel #13
0
 /// <summary>
 /// Sets <see cref="Alachisoft.NosDB.Common.DataStructures.AggregateFunctionType"/> of specifeid column
 /// </summary>
 /// <param name="columnName">Name of column</param>
 /// <param name="type"><see cref="Alachisoft.NosDB.Common.DataStructures.AggregateFunctionType"/> to set</param>
 public void SetAggregateFunctionType(string columnName, AggregateFunctionType type)
 {
     _dataStringIndex[columnName].AggregateFunctionType = type;
 }
Beispiel #14
0
        /// <summary>
        /// Adds a new column in <see cref="Alachisoft.NosDB.Common.DataStructures.Recordset"/>
        /// </summary>
        /// <param name="columnName">Name of column</param>
        /// <param name="isHidden">IsHidden property of column</param>
        /// <param name="columnType"></param>
        /// <param name="aggregateFunctionType"></param>
        /// <returns>fasle if column with same name already exists, true otherwise</returns>
        public bool AddColumn(string columnName, bool isHidden, ColumnType columnType, AggregateFunctionType aggregateFunctionType)
        {
            if (_dataStringIndex.ContainsKey(columnName))
            {
                return(false);
            }
            RecordColumn column = new RecordColumn(columnName, isHidden);

            column.Type = columnType;
            column.AggregateFunctionType    = aggregateFunctionType;
            _dataIntIndex[this.ColumnCount] = column;
            _dataStringIndex[columnName]    = column;
            if (isHidden)
            {
                _hiddenColumnCount++;
            }
            return(true);
        }
Beispiel #15
0
 /// <summary>
 /// Adds a new column in <see cref="Alachisoft.NosDB.Common.DataStructures.Recordset"/>
 /// </summary>
 /// <param name="columnName">Name of column</param>
 /// <param name="isHidden">IsHidden property of column</param>
 /// <param name="aggregateFunctionType"></param>
 /// <returns>fasle if column with same name already exists, true otherwise</returns>
 public bool AddColumn(string columnName, bool isHidden, AggregateFunctionType aggregateFunctionType)
 {
     return(this.AddColumn(columnName, isHidden, ColumnType.AttributeColumn, aggregateFunctionType));
 }
 public DecimalAggregator(AggregateFunctionType type)
 {
     this.aggregateType = type;
 }
Beispiel #17
0
 private SelectStatement AggregateColumn(AggregateFunctionType aggregate_function_type, string column_name, string alias)
 {
     Columns.Add(new SelectColumn(new AggregateFunction(aggregate_function_type, column_name), alias));
     return(this);
 }
Beispiel #18
0
 public LongAggregator(AggregateFunctionType type)
 {
     this.aggregateType = type;
 }
Beispiel #19
0
 public DoubleAggregator(AggregateFunctionType type)
 {
     this.aggregateType = type;
 }
 public AggregateFunction(AggregateFunctionType type)
 {
     Type = type;
 }
 public IntegerAggregator(AggregateFunctionType type)
 {
     this.aggregateType = type;
 }
Beispiel #22
0
 public ShortAggregator(AggregateFunctionType type)
 {
     this.aggregateType = type;
 }
Beispiel #23
0
 public AggregateFunction(AggregateFunctionType aggregate_function_type, string column_name)
 {
     _aggregateFunctionType = aggregate_function_type;
     _expression            = new SqlColumnName(column_name);
 }
Beispiel #24
0
 void ICompactSerializable.Deserialize(Runtime.Serialization.IO.CompactReader reader)
 {
     _aggregateFunctionResult = (DictionaryEntry)reader.ReadObject();
     _searchKeysResult = reader.ReadObject() as ArrayList;
     _searchEntriesResult = reader.ReadObject() as Hashtable;
     _queryType = (QueryType)reader.ReadInt32();
     _aggregateFunctionType = (AggregateFunctionType)reader.ReadInt32();
 }
Beispiel #25
0
 private SelectStatement AggregateColumn(AggregateFunctionType aggregate_function_type, ISqlExpression expression, string alias)
 {
     Columns.Add(new SelectColumn(new AggregateFunction(aggregate_function_type, expression), alias));
     return(this);
 }