Esempio n. 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);
            }
        }
        public override void WriteSql(StringBuilder sql)
        {
            // changes sql_mode to allow inserting data without identity columns
            if (ReturningSelect != null && ReturningSelect.Columns.Count > 0)
            {
                sql.Append("SET SESSION sql_mode='ANSI';");
            }

            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);
            }
        }
Esempio n. 3
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);
            }
        }