internal void Classify(QueriesDict dict) { foreach (var item in items) { switch (item.LoggerType) { case LoggerTypes.NamedQuery: ClassifyNamedQuery(dict, item); break; case LoggerTypes.SQL: ClassifySQL(dict, item); break; } } }
private static void ProcessLog(string queriesPath, string logPath, string logName) { var parser = new LogParser(); parser.Load(Path.Combine(logPath, logName)); parser.Validate(); var dict = new QueriesDict(); dict.Load(queriesPath); parser.Classify(dict); var ext = Path.GetExtension(logName); var pureName = Path.GetFileNameWithoutExtension(logName); var resName = pureName + "_decode" + ext; parser.Dump(Path.Combine(logPath, resName)); //Console.ReadLine(); }
private static void ClassifySQL(QueriesDict dict, LogItem item) { if (item.Operation == Operations.Invalid) { return; } //var sData = item.Value.ToString(); if (item.LastNamedItem != null) { // possible something interesting //var sData2 = item.LastNamedItem.Body; //if (sData.StartsWith(sData2)) //{ item.QueryName = item.LastNamedItem.QueryName; item.LastNamedItem.Hide = true; //} } else { //item.QueryName = dict.GetQuery(sData, item.Line); } }
private static void ClassifyNamedQuery(QueriesDict dict, LogItem item) { item.Body = LogParserHelper.GetNamedQueryBody(item.Value.ToString()); item.QueryName = dict.GetQuery(item.Body, item.Line); }