public static NormalizedSqlResult GetNormalizedSqlHash(string sql, string sqlHash) { NormalizedSqlResult result; if (_normalizedSqlHashCache.TryGetValue(sqlHash, out result)) { return(result); } var scriptFragment = AnalyzeFragmentVisitor(sql, sqlHash, new SqlNormalizerVisitor()); var scriptGenerator = new Sql120ScriptGenerator(); string script; scriptGenerator.GenerateScript(scriptFragment, out script); result = new NormalizedSqlResult { OriginalSqlHash = sqlHash, NormalizedSqlHash = script.Trim().ComputeHash() }; _normalizedSqlHashCache.TryAdd(sqlHash, result); return(result); }
public static NormalizedSqlResult GetNormalizedSqlHash(string sql, string sqlHash) { NormalizedSqlResult result; if (_normalizedSqlHashCache.TryGetValue(sqlHash, out result)) { return result; } var scriptFragment = AnalyzeFragmentVisitor(sql, sqlHash, new SqlNormalizerVisitor()); var scriptGenerator = new Sql120ScriptGenerator(); string script; scriptGenerator.GenerateScript(scriptFragment, out script); result = new NormalizedSqlResult { OriginalSqlHash = sqlHash, NormalizedSqlHash = script.Trim().ComputeHash() }; _normalizedSqlHashCache.TryAdd(sqlHash, result); return result; }