コード例 #1
0
        private string GetSQL(string sql)
        {
            SqlOMEngine engine = new SqlOMEngine();

            engine.ParseSQL(RendererType.MsSQL, sql);
            string resSql = engine.GetGeneratedSql();

            RemoveBrackets(ref resSql);

            return(resSql);
        }
コード例 #2
0
ファイル: MainF.cs プロジェクト: WiseGus/Wizard-Of-Om
        private void ConvertToSqlOm(RendererType rendererType)
        {
            ctrlSqlOm.Clear();
            ctrlSqlOmToSql.Clear();
            if (string.IsNullOrEmpty(ctrlSql.Text))
            {
                return;
            }

            string sqlOmText      = string.Empty;
            string sqlOmToSqlText = string.Empty;

            Cursor = Cursors.WaitCursor;

            try {
                _Engine = new SqlOMEngine();
                _Engine.ParseSQL(rendererType, ctrlSql.Text);

                sqlOmText      = _Engine.GetGeneratedSqlOm();
                sqlOmToSqlText = _Engine.GetGeneratedSql();
            }
            catch (Exception ex) {
                sqlOmText = ex.ToString();
                ctrlSqlOmToSql.Clear();
            }
            finally {
                ctrlSqlOm.AppendText(sqlOmText);
                ctrlSqlOmToSql.AppendText(sqlOmToSqlText);

                CsDrawer.DrawKnownColors(ctrlSqlOm);
                SQLDrawer.DrawKnownColors(ctrlSqlOmToSql);

                ctrlSqlOm.Select(0, 0);
                ctrlSqlOm.ScrollToCaret();

                ValidateGeneratedSql(rendererType);

                Cursor = Cursors.Default;
            }
        }