private void ExecuteSql(DbCommand cmd, string sql) { if (dialect.SupportsSqlBatches) { var objFactory = Environment.BytecodeProvider.ObjectsFactory; ScriptSplitter splitter = (ScriptSplitter)objFactory.CreateInstance(typeof(ScriptSplitter), sql); foreach (string stmt in splitter) { log.Debug("SQL Batch: {0}", stmt); cmd.CommandText = stmt; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } } else { cmd.CommandText = sql; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } }
private async Task ExecuteSqlAsync(DbCommand cmd, string sql, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); if (dialect.SupportsSqlBatches) { var objFactory = Environment.BytecodeProvider.ObjectsFactory; ScriptSplitter splitter = (ScriptSplitter)objFactory.CreateInstance(typeof(ScriptSplitter), sql); foreach (string stmt in splitter) { log.Debug("SQL Batch: {0}", stmt); cmd.CommandText = stmt; cmd.CommandType = CommandType.Text; await(cmd.ExecuteNonQueryAsync(cancellationToken)).ConfigureAwait(false); } } else { cmd.CommandText = sql; cmd.CommandType = CommandType.Text; await(cmd.ExecuteNonQueryAsync(cancellationToken)).ConfigureAwait(false); } }
public SeparatorLineReader(ScriptSplitter splitter) : base(splitter) { }
public SqlScriptReader(ScriptSplitter splitter) : base(splitter) { }
protected ScriptReader(ScriptSplitter splitter) { Splitter = splitter; }