コード例 #1
0
 internal void Run(bool compileOnly)
 {
     if (!base.IsDisposed && !this.QueryRunning)
     {
         this._gotQueryCompletionMessage = false;
         this._compileOnly = compileOnly;
         this._memoryAtStart = GC.GetTotalMemory(false);
         this._lastExecutionProgress = 5;
         bool? nullable = null;
         this._lastAutoScrollResultsFromQuery = nullable;
         this._autoScrollResultsFromQuery = this._lastAutoScrollResultsFromQuery = nullable;
         this._pendingResultsShow = true;
         this._modifiedWhenRunning = false;
         this._uberCancelMessage = false;
         this._pendingSqlTranslation = null;
         this.lblMiscStatus.Text = "";
         this._queryCount++;
         this._outputInfoMessage = null;
         this.ClearExecutionTrackingIndicators();
         this._executionTrackingTimer.Stop();
         this.ClearExecutionTrackingIndicators();
         this._firstExecutionTrack = true;
         this._lastExecutionTrackCost2 = 0;
         this._lastExecutionTrackCost1 = 0;
         this._lastExecutionLine = -1;
         this._lastTrackInfo = null;
         this._executingQueryOptimized = UserOptionsLive.Instance.OptimizeQueries;
         this._executingQueryLanguage = this._query.QueryKind;
         this._gotPluginsReadyMessage = false;
         this.KillIEComExceptionTimer();
         this.ClearQueryHighlight();
         this.panOutput.BackColor = Color.White;
         this.panOutput.Update();
         this._docMan.MainErrorLayer.Clear();
         this._docMan.WarningsLayer.Clear();
         this._docMan.StackTraceLayer.Clear();
         this._docMan.ExecutedSelectionLayer.Clear();
         this._editor.set_IndicatorMarginVisible(false);
         this._editor.get_Document().get_LineIndicators().Clear();
         string str = this._editor.get_SelectedView().get_SelectedText();
         if (this.CheckAndPromptQueryDriver())
         {
             if (this._query != null)
             {
                 this._query.SuppressErrorsOnExistingClient();
             }
             this.ResetPluginManager(false);
             string querySelection = ((str.Trim().Length <= 1) || compileOnly) ? null : this._editor.get_SelectedView().get_SelectedText();
             QueryCompilationEventArgs lastCompiler = (this._query.RequiresRecompilation || (this._lastRanSourceSelection != querySelection)) ? null : this._lastCompilation;
             this._lastRanSourceSelection = querySelection;
             if (querySelection != null)
             {
                 this._docMan.ExecutedSelectionLayer.Add(new GrayCodeSpanIndicator(), new TextRange(0, this._editor.get_SelectedView().get_Selection().get_FirstOffset()), false);
                 this._docMan.ExecutedSelectionLayer.Add(new GrayCodeSpanIndicator(), new TextRange(this._editor.get_SelectedView().get_Selection().get_LastOffset(), this._editor.get_Document().get_Length()), false);
                 this._querySelectionStartRow = this._editor.get_SelectedView().get_Selection().get_FirstDocumentPosition().get_Line();
                 this._querySelectionStartCol = this._editor.get_SelectedView().get_Selection().get_FirstDocumentPosition().get_Character();
                 this._query.Run(querySelection, compileOnly, lastCompiler, this._pluginWinManager);
             }
             else
             {
                 this._querySelectionStartCol = 0;
                 this._querySelectionStartRow = 0;
                 this._query.Run(null, compileOnly, lastCompiler, this._pluginWinManager);
             }
             this.queryProgressBar.Style = ProgressBarStyle.Marquee;
             this.lblUberCancel.Visible = false;
             this.panError.Hide();
             this.btnResults.Text = this._query.ToDataGrids ? "&Output" : "&Results";
             this.btnSql.Text = ((this._query.Repository == null) || (!(this._query.Repository.DriverLoader.InternalID == "AstoriaAuto") && !(this._query.Repository.DriverLoader.InternalID == "DallasAuto"))) ? "&SQL" : "Reque&st Log";
             if (!compileOnly)
             {
                 this.SetDataContent("");
                 this.SetLambdaContent("");
                 this.SetSqlContent("");
                 this._browserHidden = true;
             }
             this.EnableControls();
             this.lblExecTime.Visible = false;
             this.lblElapsed.Text = "";
             this.lblElapsed.Visible = true;
             this._clockTimer.Start();
             this._refreshTimer.Interval = 200;
             this._refreshTimer.Start();
             this.UpdateAutocompletionMsg();
             this._editor.Focus();
         }
     }
 }
コード例 #2
0
ファイル: Server.cs プロジェクト: CuneytKukrer/TestProject
 public ExecutionTrackInfo GetMainThreadPosition(bool interactive)
 {
     Func<StackFrame, RowColumn> selector = null;
     if (!((this._executionTrackDeadlocks <= 1) || interactive))
     {
         return null;
     }
     if (this.InMessageLoop)
     {
         return null;
     }
     if (this._executionTrackSignal == null)
     {
         this._executionTrackSignal = new AutoResetEvent(false);
         this._executionTrackReady = new AutoResetEvent(false);
         new Thread(new ThreadStart(this.StartExecutionTrackingBackstop)) { IsBackground = true, Priority = ThreadPriority.AboveNormal, Name = "Execution Tracking Backstop" }.Start();
     }
     ExecutionTrackInfo info2 = new ExecutionTrackInfo();
     StackTrace trace = null;
     if (!this._executionTrackReady.WaitOne(interactive ? 300 : 10))
     {
         return null;
     }
     this._executionTrackSignal.Set();
     Stopwatch stopwatch = Stopwatch.StartNew();
     int num = this._executionTrackDeadlocks;
     try
     {
         this._worker.Suspend();
         trace = new StackTrace(this._worker, true);
     }
     catch
     {
     }
     finally
     {
         try
         {
             this._worker.Resume();
         }
         catch
         {
             trace = null;
         }
     }
     stopwatch.Stop();
     info2.Cost = (int) stopwatch.ElapsedMilliseconds;
     if (this._executionTrackDeadlocks > num)
     {
         Log.Write("Execution tracking deadlock");
     }
     if ((num == 0) && (this._executionTrackDeadlocks > 0))
     {
         info2.Cost = 100;
     }
     if (trace != null)
     {
         StackFrame[] queryFrames = GetQueryFrames(trace);
         if (queryFrames.Length != 0)
         {
             if (selector == null)
             {
                 selector = f => new RowColumn { Row = f.GetFileLineNumber() - this._lineOffset, Column = f.GetFileColumnNumber() };
             }
             info2.MainThreadStack = queryFrames.Select<StackFrame, RowColumn>(selector).ToArray<RowColumn>();
         }
     }
     return info2;
 }
コード例 #3
0
 internal void ReportMainThreadPosition()
 {
     bool flag = this._firstExecutionTrack;
     this._firstExecutionTrack = false;
     if ((MainForm.Instance.CurrentQueryControl == this) && (MainForm.Instance.WindowState != FormWindowState.Minimized))
     {
         if (UserOptionsLive.Instance.ExecutionTrackingDisabled)
         {
             this.ClearExecutionTrackingIndicators();
             if ((this._editor.get_Document().get_LineIndicators().get_Count() == 0) && this._editor.get_IndicatorMarginVisible())
             {
                 this._editor.set_IndicatorMarginVisible(false);
             }
         }
         else if (!(!this._modifiedWhenRunning && this._query.IsRunning))
         {
             this._executionTrackingTimer.Stop();
             this.ClearExecutionTrackingIndicators();
         }
         else
         {
             ExecutionTrackInfo mainThreadPosition = this._query.GetMainThreadPosition(false);
             int num = this._lastExecutionTrackCost1 + this._lastExecutionTrackCost2;
             if (((mainThreadPosition != null) && flag) && (mainThreadPosition.Cost > 200))
             {
                 mainThreadPosition.Cost = 200;
             }
             if ((mainThreadPosition != null) && ((mainThreadPosition.Cost > 200) || (((mainThreadPosition.Cost > 40) && (this._lastExecutionTrackCost1 > 40)) && (this._lastExecutionTrackCost2 > 40))))
             {
                 this._executionTrackingTimer.Stop();
                 this.ClearExecutionTrackingIndicators();
                 Log.Write(string.Concat(new object[] { "Execution tracking timed out [", mainThreadPosition.Cost, ",", this._lastExecutionTrackCost1, ",", this._lastExecutionTrackCost2, "]" }));
                 this.lblMiscStatus.Text = this._outputInfoMessage = "Auto execution tracking timed out";
             }
             else if ((mainThreadPosition == null) && (this._lastTrackInfo != null))
             {
                 this._lastTrackInfo = null;
             }
             else
             {
                 this._lastTrackInfo = mainThreadPosition;
                 if (mainThreadPosition != null)
                 {
                     num += mainThreadPosition.Cost;
                     this._lastExecutionTrackCost2 = this._lastExecutionTrackCost1;
                     this._lastExecutionTrackCost1 = mainThreadPosition.Cost;
                 }
                 RowColumn[] source = (mainThreadPosition == null) ? null : mainThreadPosition.MainThreadStack;
                 if (this._currentExecutionStack != null)
                 {
                     foreach (BitmapBookmarkLineIndicator indicator in this._currentExecutionStack)
                     {
                         this._editor.get_Document().get_LineIndicators().Remove(indicator);
                     }
                 }
                 List<BitmapBookmarkLineIndicator> list = new List<BitmapBookmarkLineIndicator>();
                 if ((source != null) && (source.Length > 0))
                 {
                     Func<BitmapBookmarkLineIndicator, bool> predicate = null;
                     int line = (source[0].Row - 1) + this._querySelectionStartRow;
                     if (line == this._lastExecutionLine)
                     {
                         this._lastExecutionLineCount++;
                     }
                     else
                     {
                         this._lastExecutionLine = line;
                         this._lastExecutionLineCount = 0;
                     }
                     if (!list.Any<BitmapBookmarkLineIndicator>(i => (((int) i.get_Tag()) == line)))
                     {
                         ExecutionPointLineIndicator item = new ExecutionPointLineIndicator();
                         item.set_Tag(line);
                         list.Add(item);
                     }
                     foreach (RowColumn column in source.Skip<RowColumn>(1))
                     {
                         line = (column.Row - 1) + this._querySelectionStartRow;
                         if (predicate == null)
                         {
                             predicate = i => ((int) i.get_Tag()) == line;
                         }
                         if (!list.Any<BitmapBookmarkLineIndicator>(predicate))
                         {
                             ExecutionPointLineStackIndicator indicator3 = new ExecutionPointLineStackIndicator();
                             indicator3.set_Tag(line);
                             list.Add(indicator3);
                         }
                     }
                 }
                 if (this._currentExecutionStack == null)
                 {
                     this._currentExecutionStack = new List<BitmapBookmarkLineIndicator>();
                 }
                 else
                 {
                     using (List<BitmapBookmarkLineIndicator>.Enumerator enumerator = this._currentExecutionStack.ToList<BitmapBookmarkLineIndicator>().GetEnumerator())
                     {
                         Func<BitmapBookmarkLineIndicator, bool> func2 = null;
                         BitmapBookmarkLineIndicator existingIndicator;
                         while (enumerator.MoveNext())
                         {
                             existingIndicator = enumerator.Current;
                             if (func2 == null)
                             {
                                 func2 = i => ((int) i.get_Tag()) == ((int) existingIndicator.get_Tag());
                             }
                             if (list.FirstOrDefault<BitmapBookmarkLineIndicator>(func2) == null)
                             {
                                 existingIndicator.Opacity *= 0.55f;
                                 if (existingIndicator.Opacity > 0.3f)
                                 {
                                     this._editor.get_Document().get_LineIndicators().Add(existingIndicator, (int) existingIndicator.get_Tag());
                                 }
                                 else
                                 {
                                     this._currentExecutionStack.Remove(existingIndicator);
                                 }
                             }
                             else
                             {
                                 this._currentExecutionStack.Remove(existingIndicator);
                             }
                         }
                     }
                 }
                 foreach (BitmapBookmarkLineIndicator indicator5 in list)
                 {
                     this._editor.get_Document().get_LineIndicators().Add(indicator5, (int) indicator5.get_Tag());
                     this._currentExecutionStack.Add(indicator5);
                 }
                 if (this._currentExecutionStack.Count > 0)
                 {
                     this._editor.set_IndicatorMarginVisible(true);
                 }
                 this._executionTrackingTimer.Interval = ((170 + this._random.Next(50)) + (num * 5)) + ((this._lastExecutionLineCount > 100) ? 0x3e8 : ((this._lastExecutionLineCount > 20) ? 500 : 0));
             }
         }
     }
 }