Exemple #1
0
        protected override void ProcessRecord()
        {
            SqlScriptGeneratorOptions options = new SqlScriptGeneratorOptions();

            options.AlignClauseBodies           = alignClauseBodies;
            options.AlignColumnDefinitionFields = alignColumnDefinitionFields;
            options.AlignSetClauseItem          = alignSetClauseItem;
            options.AsKeywordOnOwnLine          = asKeywordOnOwnLine;
            options.IncludeSemicolons           = includeSemicolons;
            options.IndentationSize             = indentationSize;
            options.IndentSetClause             = indentSetClause;
            options.IndentViewBody               = indentViewBody;
            options.KeywordCasing                = keywordCasing;
            options.MultilineInsertSourcesList   = multilineInsertSourcesList;
            options.MultilineInsertTargetsList   = multilineInsertTargetsList;
            options.MultilineSelectElementsList  = multilineSelectElementsList;
            options.MultilineSetClauseItems      = multilineSetClauseItems;
            options.MultilineViewColumnsList     = multilineViewColumnsList;
            options.MultilineWherePredicatesList = multilineWherePredicatesList;
            options.NewLineBeforeCloseParenthesisInMultilineList = newLineBeforeCloseParenthesisInMultilineList;
            options.NewLineBeforeFromClause    = newLineBeforeFromClause;
            options.NewLineBeforeGroupByClause = newLineBeforeGroupByClause;
            options.NewLineBeforeHavingClause  = newLineBeforeHavingClause;
            options.NewLineBeforeJoinClause    = newLineBeforeJoinClause;
            options.NewLineBeforeOpenParenthesisInMultilineList = newLineBeforeOpenParenthesisInMultilineList;
            options.NewLineBeforeOrderByClause = newLineBeforeOrderByClause;
            options.NewLineBeforeOutputClause  = newLineBeforeOutputClause;
            options.NewLineBeforeWhereClause   = newLineBeforeWhereClause;
            options.SqlVersion = sqlVersion;

            try
            {
                SQLScripter scripter = new SQLScripter(sqlVersion, options, quotedIdentifierOff, inputScript);
                WriteObject(scripter.Script);
            }
            catch (Exception ex)
            {
                ErrorRecord errorRecord = new ErrorRecord(ex, "InvalidSQLScript", ErrorCategory.InvalidData, ex.Message);
                WriteError(errorRecord);
            }
        }
Exemple #2
0
        protected override void ProcessRecord()
        {
            SqlScriptGeneratorOptions options = new SqlScriptGeneratorOptions();
            options.AlignClauseBodies = alignClauseBodies;
            options.AlignColumnDefinitionFields = alignColumnDefinitionFields;
            options.AlignSetClauseItem = alignSetClauseItem;
            options.AsKeywordOnOwnLine = asKeywordOnOwnLine;
            options.IncludeSemicolons = includeSemicolons;
            options.IndentationSize = indentationSize;
            options.IndentSetClause = indentSetClause;
            options.IndentViewBody = indentViewBody;
            options.KeywordCasing = keywordCasing;
            options.MultilineInsertSourcesList = multilineInsertSourcesList;
            options.MultilineInsertTargetsList = multilineInsertTargetsList;
            options.MultilineSelectElementsList = multilineSelectElementsList;
            options.MultilineSetClauseItems = multilineSetClauseItems;
            options.MultilineViewColumnsList = multilineViewColumnsList;
            options.MultilineWherePredicatesList = multilineWherePredicatesList;
            options.NewLineBeforeCloseParenthesisInMultilineList = newLineBeforeCloseParenthesisInMultilineList;
            options.NewLineBeforeFromClause = newLineBeforeFromClause;
            options.NewLineBeforeGroupByClause = newLineBeforeGroupByClause;
            options.NewLineBeforeHavingClause = newLineBeforeHavingClause;
            options.NewLineBeforeJoinClause = newLineBeforeJoinClause;
            options.NewLineBeforeOpenParenthesisInMultilineList = newLineBeforeOpenParenthesisInMultilineList;
            options.NewLineBeforeOrderByClause = newLineBeforeOrderByClause;
            options.NewLineBeforeOutputClause = newLineBeforeOutputClause;
            options.NewLineBeforeWhereClause = newLineBeforeWhereClause;
            options.SqlVersion = sqlVersion;

            try
            {
                SQLScripter scripter = new SQLScripter(sqlVersion, options, quotedIdentifierOff, inputScript);
                WriteObject(scripter.Script);
            }
            catch (Exception ex)
            {
                ErrorRecord errorRecord = new ErrorRecord(ex, "InvalidSQLScript", ErrorCategory.InvalidData, ex.Message);
                WriteError(errorRecord);
            }
        }