Пример #1
0
		protected virtual string GetStatementSql (UpdateStatement statement)
		{
			StringBuilder sb = new StringBuilder ();
			
			sb.Append ("UPDATE ");
			sb.Append (GetSql (statement.Identifier));
			sb.Append (' ');
			sb.Append (Environment.NewLine);
			
			sb.Append ("SET ");
			
			int columnCount = statement.Columns.Count;
			for (int i=0; i<columnCount; i++) {
				OperatorExpression expr = new OperatorExpression (statement.Columns[i], Operator.Equals, statement.Values[i]);
				sb.Append (GetExpressionSql (expr));
				sb.Append (i != (columnCount - 1) ? ", " : "");
			}
			
			if (statement.Where != null) {
				sb.Append (GetSql (statement.Where));
				sb.Append (' ');
				sb.Append (Environment.NewLine);
			}
			
			sb.Append (';');
			return sb.ToString ();
		}
Пример #2
0
		protected virtual string GetExpressionSql (OperatorExpression expr)
		{
			return String.Concat ("(", GetSql (expr.Left), " ",
				GetOperatorSql (expr.Operator), " ",
				GetSql (expr.Right), ")");
		}
Пример #3
0
 protected virtual string GetExpressionSql(OperatorExpression expr)
 {
     return(String.Concat("(", GetSql(expr.Left), " ",
                          GetOperatorSql(expr.Operator), " ",
                          GetSql(expr.Right), ")"));
 }