本文整理汇总了C#中ISqlBuilder.AppendFormat方法的典型用法代码示例。如果您正苦于以下问题:C# ISqlBuilder.AppendFormat方法的具体用法?C# ISqlBuilder.AppendFormat怎么用?C# ISqlBuilder.AppendFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISqlBuilder
的用法示例。
在下文中一共展示了ISqlBuilder.AppendFormat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render(ISqlBuilder ctx, params Expression[] args)
{
var flag = args.Length == 3 ? "DATE_ADD" : "DATE_SUB";
var value = (TimeSpan)(args[2] as ConstantExpression).Value;
ctx.AppendFormat("{0}({0}({0}({0}(", flag);
ctx.Visit(args[1]);
ctx.AppendFormat(",INTERVAL {0} SECOND),INTERVAL {1} MINUTE),INTERVAL {2} HOUR),INTERVAL {3} DAY)"
, value.Seconds
, value.Minutes
, value.Hours
, value.Days
);
}
示例2: Render
public void Render(ISqlBuilder ctx, params Expression[] args)
{
if (args.Length != 3)
{
throw new NotSupportedException(string.Format(Res.ArgumentCountError, "Insert", "", "3"));
}
var secondStartIndex = args[1];// Expression.Constant((int)(args[1] as ConstantExpression).Value + 1);
ctx.Append("(CASE WHEN ");
ctx.Visit(secondStartIndex);
ctx.Append(" > LENGTH(");
ctx.Visit(args[0]);
ctx.Append(") THEN null ELSE (SUBSTR(");
ctx.Visit(args[0]);
ctx.Append(",1,");
ctx.Visit(Expression.Subtract(Expression.Property(args[1], "Value"), Expression.Constant(1, Types.Int32)));
ctx.Append(") || ");
ctx.Visit(args[2]);
ctx.Append(" || SUBSTR(");
ctx.Visit(args[0]);
ctx.AppendFormat(",");
ctx.Visit(secondStartIndex);
ctx.Append(",LENGTH(");
ctx.Visit(args[0]);
ctx.Append(")))END)");
}
示例3: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
var flag = args.Length == 3 ? "" : "-";
var value = (TimeSpan)(args[2] as ConstantExpression).Value;
builder.AppendFormat("DATEADD('d',{4}{0},DATEADD('h',{4}{1},DATEADD('n',{4}{2},DATEADD('s',{4}{3},"
, value.Days
, value.Hours
, value.Minutes
, value.Seconds
, flag);
builder.Visit(args[1]);
builder.Append("))))");
}
示例4: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
var flag = args.Length == 3 ? "" : "-";
var value = (TimeSpan)(args[2] as ConstantExpression).Value;
builder.Append("(");
builder.Visit(args[1]);
builder.AppendFormat(" + INTERVAL '{4}{0}' DAY + INTERVAL '{4}{1}' HOUR + INTERVAL '{4}{2}' MINUTE + INTERVAL '{4}{3}' SECOND"
, value.Days
, value.Hours
, value.Minutes
, value.Seconds
, flag);
builder.Append(")");
}
示例5: Render
public void Render(ISqlBuilder ctx, params Expression[] args)
{
//datetime(?1, '?2 year','?3 month','?4 day','?5 hour','?6 minute','?7 second')
var flag = args.Length == 3 ? "" : "-";
var value = (TimeSpan)((args[2] as NamedValueExpression).Value as ConstantExpression).Value;
ctx.Append("DATETIME(");
ctx.Visit(args[1]);
ctx.AppendFormat(", '{4}{0} day','{4}{1} hour','{4}{2} minute','{4}{3} second')"
, value.Days
, value.Hours
, value.Minutes
, value.Seconds
, flag);
}