Esempio n. 1
0
        /// <summary>
        /// Executes all of the statements that have been added. This is non-transactional. Execution will continue even if
        /// some statements fail. If you need atomicity you should ensure there is an ambient transaction.
        /// </summary>
        /// <returns>The total number of rows modified by all statements.</returns>
        public int Execute()
        {
            if (commands.Count == 0)
                return 0;

            using (var conn = db.GetOpenConnection())
            using (var set = new PublicSqlCommandSet(conn))
            {
                commands.ForEach(set.Append);
                commands.Clear();

                return set.ExecuteNonQuery();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Executes all of the statements that have been added. This is non-transactional. Execution will continue even if
        /// some statements fail. If you need atomicity you should ensure there is an ambient transaction.
        /// </summary>
        /// <returns>The total number of rows modified by all statements.</returns>
        public int Execute()
        {
            if (commands.Count == 0)
            {
                return(0);
            }

            using (var conn = db.GetOpenConnection())
                using (var set = new PublicSqlCommandSet(conn))
                {
                    commands.ForEach(set.Append);

                    return(set.ExecuteNonQuery());
                }
        }