Пример #1
0
        public int Write(List <List <string> > linesToWrite)
        {
            Log.Debug($"SqlServerWriter: Write; Count='{linesToWrite.Count}'");

            // insert
            var insertStatement = GetInsertStatements(linesToWrite);

            sqlServerService.simpleExecQuery(insertStatement, ImportTask.retryPolicyNumRetries, ImportTask.retryPolicyDelayRetries);

            return(0);
        }
Пример #2
0
        public void Init(ImportFileOptions importTask, List <string> headers)
        {
            ImportTask = importTask;
            Headers    = headers;
            Log.Debug($"SqlServerWriter: init for '{ImportTask.file}'");

            sqlCmdBuilder = new SqlCmdBuilder(importTask);

            HeaderFields = sqlCmdBuilder.GetHeaderFields(Headers);

            sqlServerService = new SqlServerService(Log, getSqlConnectionString());

            // Drop table
            sqlServerService.simpleExecQuery(GetDropTableStatement());

            // Create table
            sqlServerService.simpleExecQuery(GetCreateTableStatement());

            // Truncate Table
            sqlServerService.simpleExecQuery(GetTruncateTableStatement());
        }