internal override string CreateSqlString(CommandFactory factory, out DataParameter[] dataParameters)
        {
            DataParameter[] dp1 = null;
            string          expressionString1 = _expression1.CreateSqlString(factory, out dp1);

            DataParameter[] dp2 = null;
            string          expressionString2 = _expression2.CreateSqlString(factory, out dp2);

            dataParameters = new DataParameter[dp1.Length + dp2.Length];
            dp1.CopyTo(dataParameters, 0);
            dp2.CopyTo(dataParameters, dp1.Length);
            return(factory.CreateCatchExpressionSql(expressionString1, expressionString2, _operatorType));
        }
Exemplo n.º 2
0
        public virtual string GetHavingString(DataEntityMapping mapping, AggregateHavingExpression having, out DataParameter[] parameters, Dictionary <string, AggregateFunction> aggregateFunctionDictionary)
        {
            string havingString = null;

            parameters = null;
            if (having != null)
            {
                if (!having.IgnoreConsistency && !mapping.Equals(having.TableMapping))
                {
                    throw new LightDataException(RE.DataMappingIsNotMatchAggregationExpression);
                }
                havingString = string.Format("having {0}", having.CreateSqlString(this, out parameters, new GetAliasHandler(delegate(object obj) {
                    string alias = null;
                    if (obj is AggregateFunction)
                    {
                        foreach (KeyValuePair <string, AggregateFunction> kv in aggregateFunctionDictionary)
                        {
                            if (Object.ReferenceEquals(obj, kv.Value))
                            {
                                alias = kv.Key;
                                break;
                            }
                        }
                    }
                    else
                    {
                        throw new LightDataException(RE.UnknowOrderType);
                    }
                    return(alias);
                })));
            }
            return(havingString);
        }
Exemplo n.º 3
0
        public override string GetHavingString(DataEntityMapping mapping, AggregateHavingExpression having, out DataParameter[] parameters, Dictionary <string, AggregateFunction> aggregateFunctionDictionary)
        {
            string havingString = null;

            parameters = null;
            if (having != null)
            {
                if (!having.IgnoreConsistency && !mapping.Equals(having.TableMapping))
                {
                    throw new LightDataException(RE.DataMappingIsNotMatchAggregationExpression);
                }
                havingString = string.Format("having {0}", having.CreateSqlString(this, out parameters, new GetAliasHandler(delegate(object obj) {
                    return(null);
                })));
            }
            return(havingString);
        }