Beispiel #1
0
 public SqlStringNode Apply(SqlStringNode left, SqlStringNode right)
 {
     if (Operator == "+")
     {
         return(new SqlStringNode(left.Value + right.Value));
     }
     throw new Exception($"Cannot apply operator {Operator} to operands of type string");
 }
Beispiel #2
0
        private ISqlNode TryReduceStringToNumber(SqlStringNode asString)
        {
            switch (DataType.DataType.Keyword)
            {
            case "INT":
                return(new SqlNumberNode(int.Parse(asString.Value)));

            case "BIT":
                return(new SqlNumberNode(int.Parse(asString.Value) > 0 ? 1 : 0));

            case "BIGINT":
                return(new SqlNumberNode(long.Parse(asString.Value)));

            case "DECIMAL":
            case "DEC":
            case "NUMERIC":
                // TODO: size and precision
                return(new SqlNumberNode(decimal.Parse(asString.Value)));

            default:
                return(this);
            }
        }