Ejemplo n.º 1
0
        public HtmlPageWrapper(ISqlTreeFormatter underlyingFormatter)
        {
            if (underlyingFormatter == null)
                throw new ArgumentNullException("underlyingFormatter");

            _underlyingFormatter = underlyingFormatter;
        }
Ejemplo n.º 2
0
        private void SetFormatter()
        {
            ISqlTreeFormatter innerFormatter;

            innerFormatter = new BaiSqlFormatLib.Formatters.TSqlStandardFormatter(new BaiSqlFormatLib.Formatters.TSqlStandardFormatterOptions
            {
                IndentString             = "\\s\\s\\s\\s",                                       //缩进内容
                SpacesPerTab             = 4,
                MaxLineWidth             = Properties.Settings.Default.MaxLineWidth,             //单行字符串最大长度
                ExpandCommaLists         = Properties.Settings.Default.ExpandCommaLists,         //false 字段换行
                KeywordAlign             = Properties.Settings.Default.KeywordAlign,             //字段对齐
                TrailingCommas           = true,                                                 //true 逗号在字段之后
                SpaceAfterExpandedComma  = true,                                                 //true 逗号后追加空格
                ExpandBooleanExpressions = Properties.Settings.Default.ExpandBooleanExpressions, //true 条件换行
                ExpandCaseStatements     = Properties.Settings.Default.ExpandCaseStatements,     //true case when换行
                ExpandBetweenConditions  = Properties.Settings.Default.ExpandBetweenConditions,  //true between 换行
                ExpandInLists            = Properties.Settings.Default.ExpandInLists,            //true in 内容换行
                BreakJoinOnSections      = Properties.Settings.Default.BreakJoinOnSections,      //true join on中on 条件换行
                UppercaseKeywords        = Properties.Settings.Default.UppercaseKeywords,        //true 关键字大写
                AllUpper               = Properties.Settings.Default.AllUpper,                   //true 全部大写
                HTMLColoring           = true,                                                   //true HTML颜色标记 默认为true
                KeywordStandardization = true,                                                   //true 关键字标准化
                NewStatementLineBreaks = 2,                                                      //新语句换行数
                NewClauseLineBreaks    = 1,                                                      //遇到关键字 换行数
                AllIndent              = Properties.Settings.Default.AllIndent,                  //整体缩进一个IndentString
                AsAlign           = Properties.Settings.Default.AsAlign,                         //true as对齐
                KeywordLengthOfAs = Properties.Settings.Default.KeywordLengthOfAs                //as字段的最大长度
            });

            _formatter = new BaiSqlFormatLib.Formatters.HtmlPageWrapper(innerFormatter);
        }
 public TSqlIdentityFormatterTest()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser = new TSqlStandardParser();
     _tokenFormatter = new TSqlIdentityFormatter();
     _treeFormatter = (ISqlTreeFormatter)_tokenFormatter;
 }
 public TSqlIdentityFormatterTest()
 {
     _tokenizer      = new TSqlStandardTokenizer();
     _parser         = new TSqlStandardParser();
     _tokenFormatter = new TSqlIdentityFormatter();
     _treeFormatter  = (ISqlTreeFormatter)_tokenFormatter;
 }
 public TSqlIdentityFormatterTest()
 {
     _tokenizer      = new TSqlStandardTokenizer();
     _parser         = new TSqlStandardParser();
     _tokenFormatter = new TSqlIdentityFormatter();
     _treeFormatter  = (ISqlTreeFormatter)_tokenFormatter;
     _tokenFormatter.ErrorOutputPrefix = "";
 }
Ejemplo n.º 6
0
        public HtmlPageWrapper(ISqlTreeFormatter underlyingFormatter)
        {
            if (underlyingFormatter == null)
            {
                throw new ArgumentNullException("underlyingFormatter");
            }

            _underlyingFormatter = underlyingFormatter;
        }
Ejemplo n.º 7
0
        private void SetFormatter()
        {
            ISqlTreeFormatter innerFormatter;

            if (radio_Formatting_Standard.Checked)
            {
                innerFormatter = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatter(new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions
                {
                    IndentString             = txt_Indent.Text,
                    SpacesPerTab             = int.Parse(txt_IndentWidth.Text),
                    MaxLineWidth             = int.Parse(txt_MaxWidth.Text),
                    ExpandCommaLists         = chk_ExpandCommaLists.Checked,
                    TrailingCommas           = chk_TrailingCommas.Checked,
                    SpaceAfterExpandedComma  = chk_SpaceAfterComma.Checked,
                    ExpandBooleanExpressions = chk_ExpandBooleanExpressions.Checked,
                    ExpandCaseStatements     = chk_ExpandCaseStatements.Checked,
                    ExpandBetweenConditions  = chk_ExpandBetweenConditions.Checked,
                    ExpandInLists            = chk_ExpandInLists.Checked,
                    BreakJoinOnSections      = chk_BreakJoinOnSections.Checked,
                    UppercaseKeywords        = chk_UppercaseKeywords.Checked,
                    HTMLColoring             = chk_Coloring.Checked,
                    KeywordStandardization   = chk_EnableKeywordStandardization.Checked,
                    NewStatementLineBreaks   = int.Parse(txt_StatementBreaks.Text),
                    NewClauseLineBreaks      = int.Parse(txt_ClauseBreaks.Text)
                });
            }
            else if (radio_Formatting_Identity.Checked)
            {
                innerFormatter = new PoorMansTSqlFormatterLib.Formatters.TSqlIdentityFormatter(chk_IdentityColoring.Checked);
            }
            else
            {
                innerFormatter = new PoorMansTSqlFormatterLib.Formatters.TSqlObfuscatingFormatter(
                    chk_RandomizeKeywordCase.Checked,
                    chk_RandomizeColor.Checked,
                    chk_RandomizeLineLength.Checked,
                    chk_PreserveComments.Checked,
                    chk_KeywordSubstitution.Checked
                    );
            }

            innerFormatter.ErrorOutputPrefix = _generalResourceManager.GetString("ParseErrorWarningPrefix") + Environment.NewLine;
            _formatter = new PoorMansTSqlFormatterLib.Formatters.HtmlPageWrapper(innerFormatter);
        }
Ejemplo n.º 8
0
 public SqlFormattingManager(ISqlTokenizer tokenizer, ISqlTokenParser parser, ISqlTreeFormatter formatter)
 {
     Tokenizer = tokenizer;
     Parser    = parser;
     Formatter = formatter;
 }
Ejemplo n.º 9
0
 //most common use-case, define only formatter
 public SqlFormattingManager(ISqlTreeFormatter formatter) : this(new Tokenizers.TSqlStandardTokenizer(), new Parsers.TSqlStandardParser(), formatter)
 {
 }