Beispiel #1
0
        public override void WriteSql(StringBuilder sql)
        {
            sql.Append("UPDATE ");
            Target.WriteSql(sql);
            sql.Append(" SET ");

            string seperator = "";

            for (int i = 0; i < Properties.Count; i++)
            {
                sql.Append(seperator);
                Properties[i].WriteSql(sql);
                sql.Append("=");
                Values[i].WriteSql(sql);
                seperator = ", ";
            }
            if (Where != null)
            {
                sql.Append(" WHERE ");
                Where.WriteSql(sql);
            }
            if (ReturningSelect != null)
            {
                sql.Append(";\r\n");
                ReturningSelect.WriteSql(sql);
            }
        }
Beispiel #2
0
        public override void WriteSql(StringBuilder sql)
        {
            sql.Append("INSERT INTO ");
            Target.WriteSql(sql);
            if (Sets.Count > 0)
            {
                sql.Append("(");
                WriteList(Sets, sql);
                sql.Append(")");
            }
            sql.Append(" VALUES ");
            sql.Append("(");
            WriteList(Values, sql);
            sql.Append(")");

            if (ReturningSelect != null)
            {
                sql.Append(";\r\n");
                ReturningSelect.WriteSql(sql);
            }
        }