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"); }
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); } }