public string FormatTSql([FromBody] FormatTSqlModel model) { return(FormatTSqlWithOptions(new FormatTSqlModel() { InputString = model.InputString })); }
public string FormatTSqlWithOptions([FromBody] FormatTSqlModel model) { PoorMansTSqlFormatterRedux.Interfaces.ISqlTreeFormatter formatter = null; if (model.ReFormat) { formatter = new PoorMansTSqlFormatterRedux.Formatters.TSqlStandardFormatter(new PoorMansTSqlFormatterRedux.Formatters.TSqlStandardFormatterOptions { IndentString = model.Indent, SpacesPerTab = model.SpacesPerTab, MaxLineWidth = model.MaxLineWidth, NewStatementLineBreaks = model.StatementBreaks, NewClauseLineBreaks = model.ClauseBreaks, ExpandCommaLists = model.ExpandCommaLists, TrailingCommas = model.TrailingCommas, SpaceAfterExpandedComma = model.SpaceAfterExpandedComma, ExpandBooleanExpressions = model.ExpandBooleanExpressions, ExpandCaseStatements = model.ExpandCaseStatements, ExpandBetweenConditions = model.ExpandBetweenConditions, BreakJoinOnSections = model.BreakJoinOnSections, UppercaseKeywords = model.UppercaseKeywords, HTMLColoring = model.Coloring, KeywordStandardization = model.KeywordStandardization, ExpandInLists = model.ExpandInLists }); } else if (model.Obfuscate) { formatter = new PoorMansTSqlFormatterRedux.Formatters.TSqlObfuscatingFormatter( model.RandomizeKeywordCase, model.RandomizeColor, model.RandomizeLineLengths, model.PreserveComments, model.EnableKeywordSubstitution ); } else { formatter = new PoorMansTSqlFormatterRedux.Formatters.TSqlIdentityFormatter(model.Coloring); } if (model.UseParseErrorPlaceholder) { formatter.ErrorOutputPrefix = "{PARSEERRORPLACEHOLDER}"; } return(FormatTSqlWithFormatter(model.InputString, formatter)); }