public bool VisitExprTypeString(ExprTypeString expr, TCtx arg) { var res = this.Visit(expr, "TypeString", arg, out var argOut); this.VisitPlainProperty("Size", expr.Size, argOut); this.VisitPlainProperty("IsUnicode", expr.IsUnicode, argOut); this.VisitPlainProperty("IsText", expr.IsText, argOut); this._visitor.EndVisitExpr(expr, arg); return(res); }
public override bool VisitExprTypeString(ExprTypeString exprTypeString, IExpr?parent) { if (exprTypeString.IsUnicode) { if (exprTypeString.IsText) { this.AppendName("ntext"); } else { this.AppendName("nvarchar"); } } else { if (exprTypeString.IsText) { this.AppendName("text"); } else { this.AppendName("varchar"); } } if (exprTypeString.Size.HasValue) { if (!exprTypeString.IsText) { this.Builder.Append('('); this.Builder.Append(exprTypeString.Size.Value); this.Builder.Append(')'); } else { throw new SqExpressException("text type cannot have a length"); } } else { if (!exprTypeString.IsText) { this.Builder.Append("(MAX)"); } } return(true); }
public static ExprTypeString WithIsText(this ExprTypeString original, Boolean newIsText) => new ExprTypeString(size: original.Size, isUnicode: original.IsUnicode, isText: newIsText);
public static ExprTypeString WithSize(this ExprTypeString original, Int32?newSize) => new ExprTypeString(size: newSize, isUnicode: original.IsUnicode, isText: original.IsText);
public abstract bool VisitExprTypeString(ExprTypeString exprTypeString, IExpr?parent);
TRes IExprTypeVisitor <TRes, ExprValueTypeAnalyzerCtx <TRes, TCtx> > .VisitExprTypeString(ExprTypeString exprTypeString, ExprValueTypeAnalyzerCtx <TRes, TCtx> ctx) { return(ctx.ValueVisitor.VisitString(ctx.Ctx, null, exprTypeString.Size, false)); }