示例#1
0
        void w_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                PatternEntity pe  = e.Argument as PatternEntity;
                Regex         reg = new Regex(pe.PatternString, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                Match         m   = reg.Match(pe.SQL);
                String        sql = string.Empty;

                if (m.Success)
                {
                    sql = m.Groups[1].Value;
                }
                sql = "select * from " + sql + " limit 0";

                List <string> list = new List <string>();
                XmlHelper     rsp  = new XmlHelper(MainForm.CurrentProject.Query(sql));
                foreach (XmlElement xml in rsp.GetElements("Metadata/Column"))
                {
                    list.Add(xml.GetAttribute("Field"));
                }
                e.Result = list;
            }
            catch { }
        }
示例#2
0
        private void MakeSuggest()
        {
            SuggestionTarget = new List <string>();
            string patternString = string.Empty;

            patternString = @"\sfrom\s(.*)\swhere\s";

            PatternEntity pe = new PatternEntity();

            pe.PatternString = patternString;
            pe.SQL           = txtSQLTemplate.Text;

            BackgroundWorker w = new BackgroundWorker();

            w.DoWork             += new DoWorkEventHandler(w_DoWork);
            w.RunWorkerCompleted += new RunWorkerCompletedEventHandler(w_RunWorkerCompleted);
            w.RunWorkerAsync(pe);
        }
        private void MakeSuggest()
        {
            SuggestionTarget = new List<string>();
            string patternString = string.Empty;

            patternString = @"\sfrom\s(.*)\swhere\s";

            PatternEntity pe = new PatternEntity();
            pe.PatternString = patternString;
            pe.SQL = txtSQLTemplate.Text;

            BackgroundWorker w = new BackgroundWorker();
            w.DoWork += new DoWorkEventHandler(w_DoWork);
            w.RunWorkerCompleted += new RunWorkerCompletedEventHandler(w_RunWorkerCompleted);
            w.RunWorkerAsync(pe);

        }