/// <summary> /// 返回 字符串 内容 /// </summary> /// <returns>返回 字符串 内容</returns> public override string ToString() { __sql.Append("("); __sql.Append(__args[0]); __sql.Append(")"); return(__sql.ToString()); }
private UpdateBuilder <T> InternalAppend(string field, Expression value) { if (!__sql.IsEmpty) { __sql.Append(", "); } __sql.AppendFormat("{0} = ", field); base.Visit(value); return(this); }
private GetBuilder <T> Select(string columnName) { if (__select.IsNull() || __select[0] == '*') { __select = new STR(); } if (!__select.IsEmpty) { __select.Append(", "); } __select.Append(columnName); return(this); }
/// <summary> /// 处理二元运算表达式 /// </summary> /// <param name="expression">表达式</param> /// <returns>表达式</returns> protected override Expression VisitBinary(BinaryExpression expression) { __sql.Append("("); this.Visit(expression.Left); __sql.Append(this.GetOperator(expression.NodeType)); this.Visit(expression.Right); __sql.Append(")"); return(expression); }
private GetBuilder <T> OrderBy(bool desc, string orderby) { if (__orderby.IsNull()) { __orderby = new STR(); } if (string.IsNullOrEmpty(orderby)) { return(this); } if (!__orderby.IsEmpty) { __orderby.Append(", "); } __orderby.Append(orderby); if (desc) { __orderby.Append(" DESC "); } return(this); }
private string ParseString() { ConsumeToken(); // " s.Length = 0; int runIndex = -1; while (index < json.Length) { var c = json[index++]; if (c == '"') { if (runIndex != -1) { if (s.Length == 0) { return(new string(json, runIndex, index - runIndex - 1)); } s.Append(json, runIndex, index - runIndex - 1); } return(s.ToString()); } if (c != '\\') { if (runIndex == -1) { runIndex = index - 1; } continue; } if (index == json.Length) { break; } if (runIndex != -1) { s.Append(json, runIndex, index - runIndex - 1); runIndex = -1; } switch (json[index++]) { case '"': s.Append('"'); break; case '\\': s.Append('\\'); break; case '/': s.Append('/'); break; case 'b': s.Append('\b'); break; case 'f': s.Append('\f'); break; case 'n': s.Append('\n'); break; case 'r': s.Append('\r'); break; case 't': s.Append('\t'); break; case 'u': var remainingLength = json.Length - index; if (remainingLength < 4) { break; } // parse the 32 bit hex into an integer codepoint var codePoint = ParseUnicode(json[index], json[index + 1], json[index + 2], json[index + 3]); s.Append((char)codePoint); // skip 4 chars index += 4; break; } } throw new Exception(Localization.Resources.UnexpectedlyReachedEndOfStringException); }
protected override Expression VisitBinary(BinaryExpression expression) { this.Visit(expression.Left); __select.Append(this.GetOperator(expression.NodeType)); var temp = __needdelimiter; __needdelimiter = false; this.Visit(expression.Right); __needdelimiter = temp; return(expression); }
/// <summary> /// 处理构造函数调用表达式 /// </summary> /// <param name="expression">表达式</param> /// <returns></returns> protected override Expression VisitNew(NewExpression expression) { var members = expression.Members; var arguments = expression.Arguments; var len = members.Count < arguments.Count ? members.Count : arguments.Count; for (int i = 0; i < len; i++) { this.Visit(arguments[i]); if (__isrowno) { __rownoname = members[i].Name; __isrowno = false; continue; } if (arguments[i].NodeType == ExpressionType.MemberAccess && (arguments[i] as MemberExpression).Member.Name == members[i].Name) { continue; } select.Append(context.Database._dbType.EscapeNewName(members[i].Name)); } return(expression); }
private WhereBuilder Append(Expression expression, string type) { if (expression != null) { if (!__sql.IsEmpty) { __sql.Append(type); } base.Visit(expression); } return(this); }