Пример #1
0
        private void GetViews()
        {
            this.toolStripStatusLabel1.Text = "Getting views please wait";
              this.btnCheckViews.Enabled = false;
              ViewsListBox.Items.Clear();

              SQLInfo sqlInfo = new SQLInfo();
              sqlInfo.OleDbConnectionString = new OleDbConnection(this.ConnectionString);
              sqlInfo.OleDbCommandObject = new OleDbCommand("SELECT TBLS.* FROM DBC.TABLES TBLS WHERE (DATABASENAME LIKE '" + this.tbDatabaseName.Text + "') AND TABLEKIND LIKE '%V%'");

              SQLRunner sqlRunner = new SQLRunner(sqlInfo);
              sqlRunner.OnSQLFinishedRunning += this.SQLR_OnSQLFinishedRunning;
        }
Пример #2
0
        private void CheckViewFinished(SQLInfo sqlInfo)
        {
            TDViews teradataView = null;

              foreach (TDViews view in this.ViewsListBox.Items)
              {
            if (view.DataBaseName == sqlInfo.DatabaseName && view.ViewName == sqlInfo.ViewName)
            {
              teradataView = view;
            }
              }

              if (teradataView == null)
              {
            return;
              }

              if (sqlInfo.ErrorOccured == false)
              {
            teradataView.ViewState = TDViews.TDViewState.NoErr;
            ViewsListBox.Refresh();
              }
              else
              {
            teradataView.ViewState = TDViews.TDViewState.Err;
            teradataView.ErrorText = sqlInfo.Error.Message;
            this.errorViews++;

            SQLInfo sqlinfo2 = new SQLInfo();
            sqlinfo2.DatabaseName = teradataView.DataBaseName;
            sqlinfo2.ViewName = teradataView.ViewName;
            sqlinfo2.OleDbConnectionString = new OleDbConnection(string.Format(ConnectionString, this.tbUserID.Text, this.tbPassword.Text));
            sqlinfo2.OleDbCommandObject = new OleDbCommand("SHOW VIEW " + teradataView.DataBaseName + "." + teradataView.ViewName);

            SQLRunner sqlRunner = new SQLRunner(sqlinfo2);
            sqlRunner.OnSQLFinishedRunning += this.ShowViewFinished;

            ViewsListBox.Refresh();
              }

              this.checkedViews++;

              double percentComplete = Math.Round(this.checkedViews / (double)ViewsListBox.Items.Count, 4) * 100;
              this.toolStripStatusLabel1.Text = percentComplete + "% Complete; Status: " + this.errorViews + "/" + ViewsListBox.Items.Count + " didn't run.";
        }
Пример #3
0
        private void CheckViews()
        {
            foreach (TDViews teradataView in ViewsListBox.Items)
              {
            teradataView.ViewState = TDViews.TDViewState.Checking;
            ViewsListBox.Refresh();

            SQLInfo sqlInfo = new SQLInfo();
            sqlInfo.OleDbConnectionString = new OleDbConnection(string.Format(ConnectionString, this.tbUserID.Text, this.tbPassword.Text));
            sqlInfo.OleDbCommandObject = new OleDbCommand("EXPLAIN SELECT * FROM " + teradataView.DataBaseName + "." + teradataView.ViewName);
            sqlInfo.DatabaseName = teradataView.DataBaseName;
            sqlInfo.ViewName = teradataView.ViewName;

            SQLRunner sqlRunner = new SQLRunner(sqlInfo);
            sqlRunner.OnSQLFinishedRunning += this.CheckViewFinished;
              }
        }