コード例 #1
0
ファイル: UCTableData.cs プロジェクト: radtek/toaddotnet
 private void toolStripButtonToEnd_Click(object sender, EventArgs e)
 {
     uLib = new DGVQuery(dataGridViewOracleFields, connexion);
     uLib.ClearData = false;
     //uLib.Start(string.Format("SELECT * FROM {0}", tablename));
     toolStripProgressBarQuery.Visible = true;
     toolStripProgressBarQuery.Value = 0;
     startTime = DateTime.Now;
     if (backgroundWorker1.IsBusy)
         backgroundWorker1.CancelAsync();
     while (backgroundWorker1.IsBusy) ;
     int rowsFetched = dataGridViewOracleFields.Rows.Count;
     backgroundWorker1.RunWorkerAsync(string.Format("SELECT * FROM (SELECT ROWNUM n, t.rowid ROW_ID, t.* FROM {0} t) s WHERE s.n > {1}", tablename, rowsFetched + 1));
 }
コード例 #2
0
ファイル: UCColumns.cs プロジェクト: radtek/toaddotnet
        private void getTable()
        {
            string SQL = "SELECT   c.cname,  " +
                         "         c.colno, " +
                         "         (SELECT c1.POSITION " +
                         "            FROM SYS.user_cons_columns c1, SYS.user_constraints a1 " +
                         "           WHERE a1.table_name = c1.table_name " +
                         "             AND a1.constraint_name = c1.constraint_name " +
                         "             AND a1.constraint_type = 'P' " +
                         "             AND a1.table_name = c.tname " +
                         "             and C1.COLUMN_NAME = c.cname ) pk, " +
                         "         DECODE (c.NULLS, 'NULL', 'Y', 'N') NULLS,  " +
                         "         c.coltype,  " +
                         "         c.width, " +
                         "         c.PRECISION,  " +
                         "         c.scale,  " +
                         "         c.defaultval,  " +
                         "         c.character_set_name, " +
                         "         ucc.comments " +
                         "    FROM user_col_comments ucc,  " +
                         "         col c " +
                         "   WHERE ucc.table_name = '" + CurrentTablename + "' " +
                         "     AND c.tname = ucc.table_name " +
                         "     AND c.cname = ucc.column_name " +
                         "ORDER BY c.tname, c.colno ";

            //uLib.Start(SQL);
            startTime = DateTime.Now;
            if (backgroundWorker1.IsBusy)
            {
                backgroundWorker1.CancelAsync();
                backgroundWorker1 = new BackgroundWorker();
                backgroundWorker1.WorkerSupportsCancellation = true;
                backgroundWorker1.WorkerReportsProgress = true;
                backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
                backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
                backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);

            }

            while (backgroundWorker1.IsBusy) ;
            uLib = new DGVQuery(dataGridViewOracleFields, connexion);
            backgroundWorker1.RunWorkerAsync(SQL);
        }
コード例 #3
0
ファイル: UCTableData.cs プロジェクト: radtek/toaddotnet
        /// <summary> 
        /// Method to execute when event is fired
        /// </summary>
        public void EventProcess(object sender, string data)
        {
            XmlDocument xmlData = new XmlDocument();
            xmlData.LoadXml(data);
            XmlNode xmlNode = null;
            foreach (XmlNode xmlNodeAction in xmlData.GetElementsByTagName("action"))
            {
                switch (xmlNodeAction.InnerText)
                {
                    case "connect":
                        // Get Info for the oracle connection
                        xmlNode = xmlData.SelectSingleNode("//ToadDotNet/action/connection");
                        if (xmlNode != null)
                        {
                            connexion.OracleConnexion.UserId = xmlNode.Attributes.GetNamedItem("userid").Value;
                            connexion.OracleConnexion.Password = xmlNode.Attributes.GetNamedItem("password").Value;
                            connexion.OracleConnexion.DataSource = xmlNode.Attributes.GetNamedItem("datasource").Value;
                            if (connexion.IsOpen)
                            {
                                connexion.Close();
                            }
                            else
                            {
                                connexion.Open();
                            }
                        }
                        break;
                    case "getview":
                    case "gettable":
                        if (!tc.TabPages.Contains(tp))
                            tc.TabPages.Insert(tabPosition, tp);
                        if (connexion.IsOpen)
                        {
                            string typeAction = xmlNodeAction.InnerText.Substring(3).Replace(" ", "");
                            xmlNode = xmlData.SelectSingleNode("//ToadDotNet/action/" + typeAction);

                            if (xmlNode != null)
                            {
                                string newtablename = xmlNode.Attributes.GetNamedItem("id").Value;
                                if (newtablename != tablename)
                                {
                                    tablename = newtablename;
                                    if (backgroundWorker1.IsBusy)
                                    {
                                        backgroundWorker1.CancelAsync();
                                        backgroundWorker1 = new BackgroundWorker();
                                        backgroundWorker1.WorkerSupportsCancellation = true;
                                        backgroundWorker1.WorkerReportsProgress = true;
                                        backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
                                        backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
                                        backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);

                                    }

                                    while (backgroundWorker1.IsBusy) ;
                                    uLib = new DGVQuery(dataGridViewOracleFields, connexion);
                                    //uLib.Start(string.Format("SELECT * FROM {0}", tablename));
                                    toolStripProgressBarQuery.Visible = true;
                                    startTime = DateTime.Now;
                                    backgroundWorker1.RunWorkerAsync(string.Format("SELECT * FROM (SELECT ROWNUM n, t.rowid ROW_ID, t.* FROM {0} t) s WHERE s.n BETWEEN {1} AND {2}", tablename, 0, 500));
                                }
                            }
                        }
                        break;
                    case "getfields":
                    case "getfield":
                    case "getfks":
                    case "getfk":
                        if (!tc.TabPages.Contains(tp))
                            tc.TabPages.Insert(tabPosition, tp);
                        break;
                    default:
                        if (tc.TabPages.Contains(tp))
                            tc.TabPages.Remove(tp);
                        break;
                }
            }
        }