Exemple #1
0
        void RunDebug()
        {
            bool          isLocal;
            StringBuilder sb = new StringBuilder();

            //Guid gSql = new Guid("{1202F5B4-3522-4149-BAD8-58B2079D704F}");
            //Guid gCLR = new Guid("{449EC4CC-30D2-4032-9256-EE18EB41B62B}");

            //get the connection-string and check whether we're doing local
            //or remote debugging
            bool ret = ValidateConnection(out isLocal);

            try {
                if (ret)
                {
                    Document doc = _app.ActiveDocument;
                    if (doc.Name.Contains("test_"))
                    {
                        string cmdText = ((TextSelection)doc.Selection).Text;
                        if (cmdText != string.Empty)
                        {
                            CreateOutputWindow("Debug");
                            ret = AttachProc(isLocal);
                            //ret = true;
                            if (ret)
                            {
                                ExecStmtDel  ed  = new ExecStmtDel(ExecStmt);
                                IAsyncResult iar = ed.BeginInvoke(cmdText, new AsyncCallback(DoneExec), ed);
                            }
                        }
                        else
                        {
                            MessageBox.Show("No statement selected to executes.", "No Debug");
                        }
                    }
                    else
                    {
                        MessageBox.Show("You need to select a statement from one of the 'test_*.sql documents.", "No Debug");
                    }
                }
            }

            finally {
                //if (proc != null) {
                //  if (ret)
                //    proc.Detach(false);

                //  proc = null; ;

                //}
            }
        }
Exemple #2
0
 void DoneExec(IAsyncResult iar)
 {
     try {
         ExecStmtDel ed  = (ExecStmtDel)iar.AsyncState;
         bool        ret = ed.EndInvoke(iar);
     }
     finally {
         if (proc != null)
         {
             proc.Detach(false);
             proc = null;;
         }
     }
 }
Exemple #3
0
        void RunDebug()
        {
            bool isLocal;
              StringBuilder sb = new StringBuilder();

              //Guid gSql = new Guid("{1202F5B4-3522-4149-BAD8-58B2079D704F}");
              //Guid gCLR = new Guid("{449EC4CC-30D2-4032-9256-EE18EB41B62B}");

              //get the connection-string and check whether we're doing local
              //or remote debugging
              bool ret = ValidateConnection(out isLocal);
              try {
            if (ret) {
              Document doc = _app.ActiveDocument;
              if (doc.Name.Contains("test_")) {
            string cmdText = ((TextSelection)doc.Selection).Text;
            if (cmdText != string.Empty) {
              CreateOutputWindow("Debug");
              ret = AttachProc(isLocal);
              //ret = true;
              if (ret) {
                ExecStmtDel ed = new ExecStmtDel(ExecStmt);
                IAsyncResult iar = ed.BeginInvoke(cmdText, new AsyncCallback(DoneExec), ed);
              }
            }
            else {
              MessageBox.Show("No statement selected to executes.", "No Debug");
            }
              }
              else {
            MessageBox.Show("You need to select a statement from one of the 'test_*.sql documents.", "No Debug");
              }
            }

              }

              finally {
            //if (proc != null) {
            //  if (ret)
            //    proc.Detach(false);

            //  proc = null; ;

            //}
              }
        }