コード例 #1
0
ファイル: QueryWindow.cs プロジェクト: stevencohn/Orqa
        //========================================================================================
        // ShowOpenCursors()
        //========================================================================================

        /// <summary>
        /// Opens a new query window and executes the SELECT FROM v$open_cursors statement.
        /// </summary>

        public void ShowOpenCursors()
        {
            string formattedSQL =
                "SELECT count(*), sql_text\n"
                + "  FROM v$open_cursor\n"
                + " GROUP BY sql_text\n"
                + " ORDER BY 1 DESC\n";

            InsertText(formattedSQL);

            IsSaved = true;
            SetTitle();

            //Execute(ParseMode.Sequential, editorView.SelectedText, 1);

            Logger.WriteLine("QueryWindow.ShowOpenCursors");
            commander.ExecuteControls.IsEnabled = true;
            SetStatusMessage(RxExecutingStatus);

            resultsView.Clear();

            if (splitContainer.Panel2Collapsed)
            {
                DoToggleResults(null, null);
            }

            splitContainer.SplitterDistance = (int)(splitContainer.Height * 0.2);

            // catch up on Windows messages just to look better
            Application.DoEvents();

            queries.Clear();
            driver.Reset();

            var query  = new Database.Query(formattedSQL.Replace("\n", String.Empty));
            var parser = new StatementParser();

            parser.ParseStatement(dbase, query, browser);
            queries.Add(query);

            // execute query collection

            resultsView.Lock();

            driver.Execute(queries, basePath, 1);
        }