本文整理汇总了C#中ISqlBuilder.Visit方法的典型用法代码示例。如果您正苦于以下问题:C# ISqlBuilder.Visit方法的具体用法?C# ISqlBuilder.Visit怎么用?C# ISqlBuilder.Visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISqlBuilder
的用法示例。
在下文中一共展示了ISqlBuilder.Visit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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(")");
}
示例2: 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");
}
示例3: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
if (args == null || (args.Length != 2 && args.Length != 3))
{
throw new NotSupportedException(string.Format(Res.ArgumentCountError, "substring", "", "2 or 3"));
}
builder.Append("CASE WHEN LENGTH(");
builder.Visit(args[1]);
builder.Append(") > LENGTH(");
builder.Visit(args[0]);
builder.Append(") THEN NULL ELSE SUBSTR(");
builder.Visit(args[0]);
builder.Append(",").Visit(args[1]);
if (args.Length == 2)
{
builder.Append(",LENGTH(").Visit(args[0]);
builder.Append(")");
}
else
{
builder.Append(",").Visit(args[2]);
}
builder.Append(") END");
}
示例4: 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(")");
}
}
}
示例5: 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(")");
}
示例6: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
if (args.Length != 2 && args.Length != 3)
{
throw new NotSupportedException(string.Format(Res.ArgumentCountError, "PadRight", "", "2 or 3"));
}
builder.Append("CASE WHEN LEN(");
builder.Visit(args[0]);
builder.Append(") >= ");
builder.Visit(args[1]);
builder.Append(" THEN ");
builder.Visit(args[0]);
builder.Append(" ELSE (");
builder.Visit(args[0]);
builder.Append("+");
if (args.Length == 2)
{
builder.Append("SPACE(");
builder.Visit(args[1]);
builder.Append(" - LEN(");
builder.Visit(args[0]);
builder.Append(")))");
}
else
{
builder.Append("REPLICATE(");
builder.Visit(args[2]);
builder.Append(",");
builder.Visit(args[1]);
builder.Append(" - LEN(");
builder.Visit(args[0]);
builder.Append(")))");
}
builder.Append(" END");
}
示例7: 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);
}
示例8: 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))");
}
示例9: 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("')");
}
示例10: Render
public void Render(ISqlBuilder visitor, params Expression[] args)
{
if (args.Length != 2)
throw new ArgumentException("function ' dateadd takes 2 arguments.");
visitor.Append("(");
visitor.Visit(args[0]);
visitor.Append(" + interval '");
ExecuteContext.Items.Add(OracleDateTimeFunctions.IgonreIntDoubleConvert, null);
visitor.Visit(args[1]);
ExecuteContext.Items.Remove(OracleDateTimeFunctions.IgonreIntDoubleConvert);
visitor.Append("' " + Type.ToString() + ")");
}
示例11: 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))");
}
示例12: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
if (args == null)
throw new NotSupportedException("args");
if (args.Length != 1)
throw new NotSupportedException(string.Format(Res.ArgumentCountError, "IsNullOrWhiteSpace", "", "1"));
builder.Append("(");
builder.Visit(args[0]);
builder.Append(" IS NULL OR ");
builder.Visit(args[0]);
builder.Append(" = '' OR LTRIM(");
builder.Visit(args[0]);
builder.Append(") IS NULL)");
}
示例13: 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)");
}
示例14: Render
public void Render(ISqlBuilder builder, params Expression[] args)
{
var value = args[1];
value = FormatValue(value,
(bool)(args[2] as ConstantExpression).Value
, (bool)(args[3] as ConstantExpression).Value
, (bool)(args[4] as ConstantExpression).Value);
builder.Append("(");
builder.Visit(args[0]);
builder.Append(" LIKE ");
builder.Visit(value);
builder.Append(")");
}
示例15: 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)");
}