/// <summary>
        /// TBD
        /// </summary>
        public static void GetScriptBlocks(EncodedResource encodedResource, IList <string> blockCollector, params Regex[] blockDelimiterPatterns)
        {
            AssertUtils.ArgumentNotNull(blockCollector, "blockCollector");

            using (TextReader sr = encodedResource.OpenReader())
            {
                string script = sr.ReadToEnd();

                // the first pattern that finds a match will be used, if any
                Regex patternToUse = BLOCKDELIM_DEFAULT_EXP;
                if (blockDelimiterPatterns != null)
                {
                    foreach (Regex pattern in blockDelimiterPatterns)
                    {
                        if (pattern.IsMatch(script))
                        {
                            patternToUse = pattern;
                            break;
                        }
                    }
                }

                Split(script, patternToUse, blockCollector);
            }
        }
        /// <summary>
        /// Execute the given script
        /// </summary>
        private static void ExecuteSqlScriptInternal(IAdoOperations adoTemplate, EncodedResource resource, bool continueOnError, params Regex[] blockDelimiter)
        {
            AssertUtils.ArgumentNotNull(adoTemplate, "adoTemplate");
            AssertUtils.ArgumentNotNull(resource, "resource");

            if (!CollectionUtils.HasElements(blockDelimiter))
            {
                blockDelimiter = BLOCKDELIM_ALL_EXP;
            }

            List <string> statements = new List <string>();

            try
            {
                GetScriptBlocks(resource, statements, blockDelimiter);
            }
            catch (Exception ex)
            {
                throw new DataAccessResourceFailureException("Failed to open SQL script from " + resource, ex);
            }

            foreach (string statement in statements)
            {
                try
                {
                    adoTemplate.ExecuteNonQuery(CommandType.Text, statement);
                }
                catch (DataAccessException dae)
                {
                    if (!continueOnError)
                    {
                        throw;
                    }
                    Log.Warn(string.Format("SQL statement failed:{0}", statement), dae);
                }
            }
        }
 /// <summary>
 /// Execute the given script
 /// </summary>
 public static void ExecuteSqlScript(IAdoOperations adoTemplate, EncodedResource resource, bool continueOnError, params Regex[] blockDelimiter)
 {
     ExecuteSqlScriptInternal(adoTemplate, resource, continueOnError, blockDelimiter);
 }