From 5232289266083db98245a5d06f1152127640fa33 Mon Sep 17 00:00:00 2001 From: mkaboud Date: Fri, 12 Jun 2015 12:44:22 -0700 Subject: [PATCH] Update format.scrub Updating regular expressions to avoid exponential processing time for some cases. If DB object definition contains line of dashes "-------------", the program does not finish processing and time increase exponentially. This happens at DataScrubber.Scrub method, at Regex.Replace(). Modifying the regular expressions from "(--.*)" to "(--).*" solves the issue. --- SQLCC/format.scrub | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SQLCC/format.scrub b/SQLCC/format.scrub index fa6cb24..8d1c471 100644 --- a/SQLCC/format.scrub +++ b/SQLCC/format.scrub @@ -1,15 +1,15 @@ -{1}([\s]+){0} $1 Eliminate extranious white-space +{1}([\s]+){0} $1 Eliminate extranious white-space (^[\s]*--[\s\S]+)([\n\r]+[\s]*CREATE[\s]+(PROCEDURE|FUNCTION|TRIGGER)) {0}$1{1}$2 Beginning create statement ([\s]*CREATE[\s]+(PROCEDURE|FUNCTION|TRIGGER)[\s]+[\s\S]+([\s]+AS[\s]+BEGIN[\s]+)) {0}$1{1} Beginning create statement ([\s]*END(;)*[\s]*\z) {0}$1{1} Last end statement. ([\s]*BEGIN[\s]*)({0}) $2$1 If there is a BEGIN statement near the start of coverage, include BEGIN. ({1})([\s]*END[\s]*) $2$1 If there is an END statement near the end of coverage, include END. -{1}([\s]*(--.*)*[\s]*(begin|end)*[\s]*(--.*)*[\s]*){0} $1 Include begin/end if it is surrounded by comments or just white-space. Also include comments. -(end)([\s]*(--.*)*[\s]*){0} $1{0}$2 Cover up until end statement. +{1}([\s]*(--).*[\s]*(begin|end)*[\s]*(--).*[\s]*){0} $1 Include begin/end if it is surrounded by comments or just white-space. Also include comments. +(end)([\s]*(--).*[\s]*){0} $1{0}$2 Cover up until end statement. (([\s]*ELSE[\s]*)[\s]*(--.*)*[\s]*){0} {0}$1 If there is an ELSE statemenet that was hit, cover this as well. {1}([\s]*(declare[\s]+.+)+[\n\r]+([\s]*declare[\s]+.+)*[\s]*) $1{1} DECLARE statements are not covered since profiler does not capture them if there is no default value. ([\s]*(declare[\s]+.+)+[\n\r]+([\s]*declare[\s]+.+)*[\s]*){0} {0}$1 DECLARE statements are not covered since profiler does not capture them if there is no default value. ([\s]+BEGIN)([\s]+([\s]*--.*[\r\n]+)*[\s]+){0} $1{0}$2 Include white space up until the BEGIN statement {1}(([\s]*--.*[\r\n]+)*[\s]+){0} $1 Comments need to be covered if that is all that is between two segments. {1}([\s]*[\S]+:[\s]*){0} $1 If there is a bookmark between code coverage that was not hit, include it. -({0}{1}|{1}{0}) Delete empty tags or end-to-end tags. \ No newline at end of file +({0}{1}|{1}{0}) Delete empty tags or end-to-end tags.