Ejemplo n.º 1
0
 public CommonTab(FormattedSQLBuilder builder, SQLBuilderSelectFormat selectFormat)
 {
     InitializeComponent();
     _builder           = builder;
     _formattingOptions = (SQLFormattingOptions)_builder.Options;
     _selectFormat      = selectFormat;
 }
Ejemplo n.º 2
0
        public SubQueryTab(SQLFormattingOptions formattingOptions, string prefix = "Sub-Query")
        {
            InitializeComponent();

            _formattingOptions = formattingOptions;

            if (prefix == "Sub-Query")
            {
                _selectFormat = formattingOptions.ExpressionSubQueryFormat;
            }

            if (prefix == "Derived Tables")
            {
                groupBox1.Text = "Derived tables format options";
                label1.Text    = "Derived tables indent:";
                chBxSubQueriesFromNewLines.Text = "Start derived tables from new lines";
                label2.Text = "Derived Tables format options\n" +
                              "determine the layout of sub-queries\n" +
                              "used as data sources in the query.";

                _selectFormat = formattingOptions.DerivedQueryFormat;
            }
            if (prefix == "CTE")
            {
                groupBox1.Text = "Common table expressions format options";
                label1.Text    = "CTE indent:";
                chBxSubQueriesFromNewLines.Text = "Start derived tables from new lines";
                label2.Text = "Derived Tables format options\n" +
                              "determine the layout of sub-queries\n" +
                              "used above the main query in the with clause.";

                _selectFormat = formattingOptions.CTESubQueryFormat;
            }
        }
Ejemplo n.º 3
0
        public CommonTab(SQLFormattingOptions formattingOptions, SQLBuilderSelectFormat selectFormat)
        {
            InitializeComponent();
            SelectFormat      = selectFormat;
            FormattingOptions = formattingOptions;

            LoadOptions();
        }
Ejemplo n.º 4
0
        public ExpressionsTab(SQLFormattingOptions sqlFormattingOptions, SQLBuilderSelectFormat sqlBuilderSelectFormat)
        {
            InitializeComponent();

            SelectFormat      = sqlBuilderSelectFormat;
            FormattingOptions = sqlFormattingOptions;

            LoadOptions();
        }
Ejemplo n.º 5
0
        public SubQueryTab(SQLFormattingOptions formattingOptions, SubQueryType subQueryType = SubQueryType.Expression)
        {
            FormattingOptions = new SQLFormattingOptions();

            InitializeComponent();

            FormattingOptions.Dispose();

            FormattingOptions = formattingOptions;

            switch (subQueryType)
            {
            case SubQueryType.Expression:
                SelectFormat = formattingOptions.ExpressionSubQueryFormat;
                break;

            case SubQueryType.Derived:
                GroupBoxControl.Header                 = "Derived tables format options";
                TextBlockCaptionUpDown.Text            = "Derived tables indent:";
                CheckBoxStartSubQueriesNewLine.Content = "Start derived tables from new lines";
                TextBlockDescription.Text              = "Derived Tables format options\n" +
                                                         "determine the layout of sub-queries\n" +
                                                         "used as data sources in the query.";

                SelectFormat = formattingOptions.DerivedQueryFormat;
                break;

            case SubQueryType.Cte:
                GroupBoxControl.Header                 = "Common table expressions format options";
                TextBlockCaptionUpDown.Text            = "CTE indent:";
                CheckBoxStartSubQueriesNewLine.Content = "Start CTE from new lines";
                TextBlockDescription.Text              = "CTE format options\n" +
                                                         "determine the layout of sub-queries\n" +
                                                         "used above the main query in the with clause.";

                SelectFormat = formattingOptions.CTESubQueryFormat;
                break;
            }

            LoadOptions();
        }
        public SubQueryTab(SQLFormattingOptions formattingOptions, SubQueryType type = SubQueryType.Expression)
        {
            InitializeComponent();

            FormattingOptions = formattingOptions;

            if (type == SubQueryType.Expression)
            {
                SelectFormat = formattingOptions.ExpressionSubQueryFormat;
            }

            else if (type == SubQueryType.Derived)
            {
                groupBox1.Text = "Derived tables format options";
                label1.Text    = "Derived tables indent:";
                chBxSubQueriesFromNewLines.Text = "Start derived tables from new lines";
                label2.Text = "Derived Tables format options\n" +
                              "determine the layout of sub-queries\n" +
                              "used as data sources in the query.";

                SelectFormat = formattingOptions.DerivedQueryFormat;
            }

            else if (type == SubQueryType.Cte)
            {
                groupBox1.Text = "Common table expressions format options";
                label1.Text    = "CTE indent:";
                chBxSubQueriesFromNewLines.Text = "Start CTE from new lines";
                label2.Text = "CTE format options\n" +
                              "determine the layout of sub-queries\n" +
                              "used above the main query in the with clause.";

                SelectFormat = formattingOptions.CTESubQueryFormat;
            }

            LoadOptions();
        }
Ejemplo n.º 7
0
        public SqlFormattingPage(SqlBuilderOptionsPages page, SQLFormattingOptions sqlFormattingOptions)
        {
            Modified = false;
            _page    = page;
            _sqlFormattingOptions = sqlFormattingOptions;
            _format = new SQLBuilderSelectFormat(null);

            if (_page == SqlBuilderOptionsPages.MainQuery)
            {
                _format.Assign(sqlFormattingOptions.MainQueryFormat);
            }
            else if (_page == SqlBuilderOptionsPages.DerivedQueries)
            {
                _format.Assign(sqlFormattingOptions.DerivedQueryFormat);
            }
            else if (_page == SqlBuilderOptionsPages.ExpressionSubqueries)
            {
                _format.Assign(sqlFormattingOptions.ExpressionSubQueryFormat);
            }

            InitializeComponent();

            cbPartsOnNewLines.Checked      = _format.MainPartsFromNewLine;
            cbNewLineAfterKeywords.Checked = _format.NewLineAfterPartKeywords;
            updownGlobalIndent.Value       = _format.IndentGlobal;
            updownPartIndent.Value         = _format.IndentInPart;

            cbNewLineAfterSelectItem.Checked = _format.SelectListFormat.NewLineAfterItem;

            cbNewLineAfterDatasource.Checked = _format.FromClauseFormat.NewLineAfterDatasource;
            cbNewLineAfterJoin.Checked       = _format.FromClauseFormat.NewLineAfterJoin;

            cbNewLineWhereTop.Checked = (_format.WhereFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.AllLogical ||
                                         _format.WhereFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.TopmostOr ||
                                         _format.WhereFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.TopmostLogical);
            checkNewLineWhereTop_CheckedChanged(null, new EventArgs());
            cbNewLineWhereRest.Checked = (_format.WhereFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.AllLogical);
            checkNewLineWhereRest_CheckedChanged(null, new EventArgs());
            updownWhereIndent.Value = _format.WhereFormat.IndentNestedConditions;

            cbNewLineAfterGroupItem.Checked = _format.GroupByFormat.NewLineAfterItem;

            cbNewLineHavingTop.Checked = (_format.HavingFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.AllLogical ||
                                          _format.HavingFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.TopmostOr ||
                                          _format.HavingFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.TopmostLogical);
            checkNewLineHavingTop_CheckedChanged(null, new EventArgs());
            cbNewLineHavingRest.Checked = (_format.HavingFormat.NewLineAfter == SQLBuilderConditionFormatNewLine.AllLogical);
            checkNewLineHavingRest_CheckedChanged(null, new EventArgs());
            updownHavingIndent.Value = _format.HavingFormat.IndentNestedConditions;

            updownHavingIndent.ValueChanged         += Changed;
            updownHavingIndent.TextChanged          += Changed;
            cbNewLineHavingRest.CheckedChanged      += checkNewLineHavingRest_CheckedChanged;
            cbNewLineHavingTop.CheckedChanged       += checkNewLineHavingTop_CheckedChanged;
            cbNewLineAfterGroupItem.CheckedChanged  += Changed;
            updownWhereIndent.ValueChanged          += Changed;
            updownWhereIndent.TextChanged           += Changed;
            cbNewLineWhereRest.CheckedChanged       += checkNewLineWhereRest_CheckedChanged;
            cbNewLineWhereTop.CheckedChanged        += checkNewLineWhereTop_CheckedChanged;
            cbNewLineAfterJoin.CheckedChanged       += Changed;
            cbNewLineAfterDatasource.CheckedChanged += Changed;
            cbNewLineAfterSelectItem.CheckedChanged += Changed;
            updownPartIndent.ValueChanged           += Changed;
            updownPartIndent.TextChanged            += Changed;
            updownGlobalIndent.ValueChanged         += Changed;
            updownGlobalIndent.TextChanged          += Changed;
            cbNewLineAfterKeywords.CheckedChanged   += Changed;
            cbPartsOnNewLines.CheckedChanged        += Changed;
        }
Ejemplo n.º 8
0
 public ExpressionsTab(SQLBuilderSelectFormat options)
 {
     InitializeComponent();
     _options = options;
 }