本文整理汇总了C#中ISqlBuilder.Append方法的典型用法代码示例。如果您正苦于以下问题:C# ISqlBuilder.Append方法的具体用法?C# ISqlBuilder.Append怎么用?C# ISqlBuilder.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISqlBuilder
的用法示例。
在下文中一共展示了ISqlBuilder.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public virtual void Render(ISqlBuilder builder, params Expression[] args)
{
builder.Append(name);
builder.Append("(");
builder.VisitEnumerable(args);
builder.Append(")");
}
示例2: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
var value = args[1];
var constExp = args[2] as ConstantExpression;
if (constExp != null)
{
value = FormatValue(value,
(bool)constExp.Value
, (bool)(args[3] as ConstantExpression).Value
, (bool)(args[4] as ConstantExpression).Value);
}
else
{
var nv = args[2] as NamedValueExpression;
if (nv != null)
{
constExp = nv.Value as ConstantExpression;
value = FormatValue(value,
(bool)constExp.Value
, (bool)((args[3] as NamedValueExpression).Value as ConstantExpression).Value
, (bool)((args[4] as NamedValueExpression).Value as ConstantExpression).Value);
}
}
builder.Append("(");
builder.Visit(args[0]);
builder.Append(" LIKE ");
builder.Visit(value);
builder.Append(")");
}
示例3: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
if (args.Length != 2 && args.Length != 3)
{
throw new ArgumentException(string.Format(Res.ArgumentCountError, "CASE", "", " 2 or 3 "));
}
var whens = (args[0] as ICollection<Expression>).ToArray();
var thens = (args[1] as ICollection<Expression>).ToArray();
var @else = args[2] as Expression;
builder.Append("CASE");
var lenght = whens.Length;
for (int i = 0; i < lenght; i++)
{
builder.Append(" WHEN ");
builder.Visit(whens[i]);
builder.Append(" THEN ");
builder.Visit(thens[i]);
}
if (@else != null)
{
builder.Append(" ELSE ");
builder.Visit(@else);
}
builder.Append(" END");
}
示例4: Render
public virtual void Render(ISqlBuilder visitor, params Expression[] args)
{
var targetArg = args[0];
visitor.Append("RTRIM(LTRIM(");
visitor.Visit(targetArg);
visitor.Append("))");
}
示例5: Render
public void Render(ISqlBuilder visitor, params Expression[] args)
{
var whens = (args[0] as ICollection<Expression>).ToArray();
var thens = (args[1] as ICollection<Expression>).ToArray();
var @else = args[2] as Expression;
var lenght = whens.Length;
for (int i = 0; i < lenght; i++)
{
if (i != 0)
visitor.Append(",");
visitor.Append("IIF(");
visitor.Visit(whens[i]);
visitor.Append(",");
visitor.Visit(thens[i]);
if (i == lenght - 1)
{
if (@else != null)
{
visitor.Append(",");
visitor.Visit(@else);
}
for (var j = i; j >= 0; j--)
visitor.Append(")");
}
}
}
示例6: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
if (args != null && args.Length > 0)
throw new ArgumentException(string.Format(Res.ArgumentCountError, Name, "no", ""));
builder.Append(Name);
builder.Append("()");
}
示例7: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
if (args.Length == 1)
{
builder.Append("DATE_FORMAT(");
builder.Visit(args[0]);
builder.Append(",'%H:%i:%s')");
}
}
示例8: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
builder.Append("CDate(");
builder.Visit(args[0]);
builder.Append(" & '/' & ");
builder.Visit(args[1]);
builder.Append(" & '/' & ");
builder.Visit(args[2]);
builder.Append(")");
}
示例9: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
//SUBSTRING(userName,1,2)+'ddd'+SUBSTRING(userName,3,LEN(userName))
if (args.Length != 3)
{
throw new NotSupportedException(string.Format(Res.ArgumentCountError, "Insert", "", "3"));
}
//var secondStartIndex = Expression.Constant((int)(args[1] as ConstantExpression).Value + 1);
builder.Append("(CASE WHEN ");
builder.Visit(args[1]);
builder.Append(" > LEN(");
builder.Visit(args[0]);
builder.Append(") THEN null ELSE (SUBSTRING(");
builder.Visit(args[0]);
builder.Append(",1,");
builder.Visit(Expression.Subtract(Expression.Property(args[1], "Value"), Expression.Constant(1, Types.Int32)));
builder.Append(") + ");
builder.Visit(args[2]);
builder.Append(" + SUBSTRING(");
builder.Visit(args[0]);
builder.Append(",");
builder.Visit(args[1]);
builder.Append(",LEN(");
builder.Visit(args[0]);
builder.Append("))) END)");
}
示例10: Render
public void Render(ISqlBuilder visitor, params Expression[] args)
{
if (args == null || (args.Length != 2 && args.Length != 3))
{
throw new NotSupportedException(string.Format(Res.ArgumentCountError, "remove()", "", " 2 or 3 "));
}
visitor.Append("IIF((LEN(");
visitor.Visit(args[0]);
visitor.Append(") < ");
visitor.Visit(args[1]);
visitor.Append("),NULL,REPLACE(");
visitor.Visit(args[0]);
visitor.Append(",MID(");
visitor.Visit(args[0]);
visitor.Append(",");
visitor.Visit(args[1]);
if (args.Length == 2)
{
visitor.Append(",8000)");
}
else
{
visitor.Append(",");
visitor.Visit(args[2]);
visitor.Append(")");
}
visitor.Append(",''))");
}
示例11: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
var year = args[0];
var month = args[1];
builder.Append("(CASE");
builder.Append(" WHEN ");
builder.Visit(year);
builder.Append("% 4 = 0 AND(");
builder.Visit(year);
}
示例12: Render
public void Render(ISqlBuilder visitor, params Expression[] args)
{
if (args.Length != 2)
throw new ArgumentException(string.Format(Res.ArgumentCountError, "dateadd", "", " 2 "));
var addPart = (args[1] as ConstantExpression).Value;
visitor.Append("(");
visitor.Visit(args[0]);
visitor.Append(" + interval '" + addPart.ToString() + "' " + Type.ToString() + ")");
}
示例13: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
builder.Append("IIF(");
builder.Visit(args[0]);
builder.Append(" = ");
builder.Visit(args[1]);
builder.Append(", 0, IIF(");
builder.Visit(args[0]);
builder.Append(" < ");
builder.Visit(args[1]);
builder.Append(", -1, 1))");
}
示例14: Render
public void Render(ISqlBuilder ctx, params Expression[] args)
{
ctx.Append("DATETIME(");
ctx.Visit(args[0]);
ctx.Append(",'");
//ctx.Append((args[0] as ConstantExpression).Value);
ExecuteContext.Items.Add(SQLiteDateTimeFunctions.IgonreIntDoubleConvert, null);
ctx.Visit(args[1]);
ExecuteContext.Items.Remove(SQLiteDateTimeFunctions.IgonreIntDoubleConvert);
ctx.Append(" ");
ctx.Append(type);
ctx.Append("')");
}
示例15: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
if (args.Length != 2)
{
throw new NotSupportedException(string.Format(Res.ArgumentCountError, "Left", "", "2"));
}
builder.Append("LEFT(");
builder.Visit(args[0]);
builder.Append(",(INSTR(");
builder.Visit(args[0]);
builder.Append(",");
builder.Visit(args[1]);
builder.Append(")-1))");
}