예제 #1
0
 public override string ToString()
 {
     if (ColumnAlias.HasValue())
     {
         return($"SqlExpression.Number({Value}), {ColumnAlias.Quoted()}");
     }
     else
     {
         return($"SqlExpression.Number({Value})");
     }
 }
예제 #2
0
 public override string ToString()
 {
     if (ToStringUseExpression || ColumnAlias.HasValue())
     {
         return($"SqlExpression.Null(), {ColumnAlias.Quoted()}");
     }
     else
     {
         return("SqlExpression.Null()");
     }
 }
예제 #3
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            string getFinalSqlStr = GetBinarySql(this);

            if (ColumnAlias.HasValue())
            {
                sb.Append($"SqlExpression.Raw(\"{getFinalSqlStr}\"), {ColumnAlias.Quoted()}");
            }
            else
            {
                sb.Append($"SqlExpression.Raw(\"{getFinalSqlStr}\")");
            }

            return(sb.ToString());
        }
예제 #4
0
 public override string ToString()
 {
     if (ToStringUseExpression)
     {
         return($"SqlExpression.Field({ColumnName.Quoted()}{(Table != null ? ", " + Table.ToString() : string.Empty)})");
     }
     else
     {
         if (Table == null && ColumnAlias.HasValue())
         {
             return($"SqlExpression.Field({ColumnName.Quoted()}){(ColumnAlias.HasValue() ? ", " + ColumnAlias.Quoted() : string.Empty)}");
         }
         else
         {
             return($"{ColumnName.Quoted()}{(Table != null ? ", " + Table.ToString() : string.Empty)}{(ColumnAlias.HasValue() ? ", " + ColumnAlias.Quoted() : string.Empty)}");
         }
     }
 }
예제 #5
0
        public override string ToString()
        {
            string tmpColumnName = ColumnName.Quoted();
            string fieldExpression;

            if (!tmpColumnName.HasValue())   // A literal may have been used
            {
                int intLiteral;
                if (int.TryParse(Convert.ToString(Value), out intLiteral))
                {
                    fieldExpression = $"SqlExpression.Number({Value})";
                }
                else
                {
                    fieldExpression = $"SqlExpression.String({Value.ToString().Quoted()})";
                }
            }
            else
            {
                fieldExpression = $"SqlExpression.Field({ColumnName.Quoted()}{(Table != null ? ", " + Table.ToString() : string.Empty)})";
            }

            if (ToStringUseExpression)
            {
                return($"SqlExpression.Function(SqlAggregationFunction.{Function.ToString()}, {fieldExpression})");
            }
            else
            {
                if (!ColumnAlias.HasValue())
                {
                    ColumnAlias = "col" + GetNextID();
                }

                if (Table == null)
                {
                    return($"SqlExpression.Function(SqlAggregationFunction.{Function.ToString()}, {fieldExpression}){(ColumnAlias.HasValue() ? ", " + ColumnAlias.Quoted() : string.Empty)}");
                }
                else
                {
                    return($"{ColumnName.Quoted()}{(Table != null ? ", " + Table.ToString() : string.Empty)}{(ColumnAlias.HasValue() ? ", " + ColumnAlias.Quoted() : string.Empty)}, SqlAggregationFunction.{Function.ToString()}");
                }
            }
        }