<commit_before>﻿using Microsoft.SqlServer.Management.Smo;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NBi.Core.Batch.SqlServer
{
    class BatchRunCommand : IDecorationCommandImplementation
    {
        private readonly string connectionString;
        private readonly string fullPath;

        public BatchRunCommand(IBatchRunCommand command, SqlConnection connection)
        {
            this.connectionString = connection.ConnectionString;
            this.fullPath = command.FullPath;
        }       

        public void Execute()
        {
            if (!File.Exists(fullPath))
                throw new ExternalDependencyNotFoundException(fullPath);

            var script = File.ReadAllText(fullPath);

            var server = new Server();
            server.ConnectionContext.ConnectionString = connectionString;
            server.ConnectionContext.ExecuteNonQuery(script);
        }
    }
}
<commit_msg>Add trace to check effective bug<commit_after>﻿using Microsoft.SqlServer.Management.Smo;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NBi.Core.Batch.SqlServer
{
    class BatchRunCommand : IDecorationCommandImplementation
    {
        private readonly string connectionString;
        private readonly string fullPath;

        public BatchRunCommand(IBatchRunCommand command, SqlConnection connection)
        {
            this.connectionString = connection.ConnectionString;
            this.fullPath = command.FullPath;
        }       

        public void Execute()
        {
            if (!File.Exists(fullPath))
                throw new ExternalDependencyNotFoundException(fullPath);

            var script = File.ReadAllText(fullPath);
            Trace.WriteLineIf(NBiTraceSwitch.TraceVerbose, script);

            var server = new Server();
            server.ConnectionContext.ConnectionString = connectionString;
            server.ConnectionContext.ExecuteNonQuery(script);
        }
    }
}

{'fraction_non_alphanumeric': 0.07158446093408992, 'fraction_numerical': 0.0, 'mean_word_length': 2.4570135746606336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6529649', 'n_tokens_mistral': 565, 'n_tokens_neox': 561, 'n_words': 121}