public void GoToSQLStatementInExecPath(SQLStatement statement) { /* switch tabs */ mainTabStrip.SelectedTab = executionPathTab; foreach (TreeNode node in executionTree.Nodes) { node.Collapse(); } var nodeParent = SQLMapToTree[statement]; while (nodeParent != null) { nodeParent.Expand(); nodeParent = nodeParent.Parent; } if (_currentModal != null) { _currentModal.Hide(); } executionTree.SelectedNode = SQLMapToTree[statement]; executionTree.Focus(); }
public void GoToSQLStatementInExecPath(SQLStatement statement) { /* switch tabs */ mainTabStrip.SelectedTab = executionPathTab; foreach (TreeNode node in executionTree.Nodes) { node.Collapse(); } if (SQLMapToTree.ContainsKey(statement)) { var nodeParent = SQLMapToTree[statement]; while (nodeParent != null) { nodeParent.Expand(); nodeParent = nodeParent.Parent; } } else { // the node doesn't exist on the tree yet, we need to build it out var parent = statement.ParentCall; BuildOutTreeForCall(parent); /* parent should exist on the tree, start building down */ } if (_currentModal != null) { _currentModal.Hide(); } executionTree.SelectedNode = SQLMapToTree[statement]; executionTree.Focus(); }
private void DeserializeSQLStatements() { // whooo boy List<string> SQLText = new List<string>(); List<string> ContextList = new List<string>(); /* read in all SQLText */ var sqlTextCount = ReadUint(); for (var x = 0; x < sqlTextCount; x++) { SQLText.Add(ReadString()); } /* read in all Context List */ var contextCount = ReadUint(); for (var x = 0; x < contextCount; x++) { ContextList.Add(ReadString()); } var totalStatements = ReadUint(); for (var x = 0; x < totalStatements; x++) { var statementIndex = ReadUint(); SQLStatement item = new SQLStatement(SQLText[(int)statementIndex]); Data.SQLStatements.Add(item); item.InternalID = ReadUint(); item.LineNumber = ReadLong(); var parentPresent = ReadBool(); if (parentPresent) { SQLToResolveParent.Add(item, ReadUint()); } item.FetchCount = ReadInt(); item.ExecTime = ReadDouble(); item.FetchTime = ReadDouble(); item.IsError = ReadBool(); var errorPresent = ReadBool(); if (errorPresent) { item.ErrorInfo = new SQLError(); item.ErrorInfo.InternalID = ReadUint(); item.ErrorInfo.ErrorPosition = (int)ReadUint(); item.ErrorInfo.ReturnCode = (int)ReadUint(); item.ErrorInfo.Message = ReadString(); } item.RCNumber = (int)ReadUint(); var contextIndex = ReadUint(); item.Context = ContextList[(int)contextIndex]; var bindCount = ReadUint(); for (var y = 0; y < bindCount; y++) { SQLBindValue bind = new SQLBindValue(); item.BindValues.Add(bind); bind.InternalID = ReadUint(); bind.Index = (int)ReadUint(); bind.Type = (int)ReadUint(); bind.Length = (int)ReadUint(); bind.Value = ReadString(); } } }
public void ProcessLine(string line, long lineNumber) { if (lineValid.IsMatch(line) == false) { return; } Match m = newStatement.Match(line); if (m.Success) { if (currentStatement != null) { Statements.Add(currentStatement); } string context = contextMarker.Match(line).Groups[0].Value; currentStatement = new SQLStatement(m.Groups[3].Value); currentStatement.Context = context; currentStatement.RCNumber = int.Parse(m.Groups[1].Value); currentStatement.LineNumber = lineNumber; return; } m = execStatement.Match(line); if (m.Success) { currentStatement.ExecTime = double.Parse(m.Groups[2].Value); return; } m = fetchStatement.Match(line); if (m.Success) { if (int.Parse(m.Groups[1].Value) != currentStatement.RCNumber) { return; } currentStatement.FetchCount++; currentStatement.FetchTime += double.Parse(m.Groups[2].Value); return; } m = bindStatement.Match(line); if (m.Success) { SQLBindValue bind = new SQLBindValue(); bind.Index = int.Parse(m.Groups[1].Value); bind.Type = int.Parse(m.Groups[2].Value); bind.Length = int.Parse(m.Groups[3].Value); bind.Value = m.Groups[4].Value; currentStatement.BindValues.Add(bind); return; } m = errPosStatement.Match(line); if (m.Success) { /* we have an error on this SQL */ currentStatement.IsError = true; currentStatement.ErrorInfo = new SQLError(); currentStatement.ErrorInfo.ErrorPosition = Int32.Parse(m.Groups[1].Value); return; } m = errorLine.Match(line); if (m.Success) { currentStatement.ErrorInfo.ReturnCode = Int32.Parse(m.Groups[1].Value); currentStatement.ErrorInfo.Message = m.Groups[2].Value; } }