public override void AddToBatch(IExpectation expectation) { _totalExpectedRowsAffected += expectation.ExpectedRowCount; var batchUpdate = CurrentCommand; Driver.AdjustCommand(batchUpdate); string lineWithParameters = null; var sqlStatementLogger = Factory.Settings.SqlStatementLogger; if (sqlStatementLogger.IsDebugEnabled || Log.IsDebugEnabled()) { lineWithParameters = sqlStatementLogger.GetCommandLineWithParameters(batchUpdate); var formatStyle = sqlStatementLogger.DetermineActualStyle(FormatStyle.Basic); lineWithParameters = formatStyle.Formatter.Format(lineWithParameters); _currentBatchCommandsLog.Append("command ") .Append(_currentBatch.CountOfCommands) .Append(":") .AppendLine(lineWithParameters); } if (Log.IsDebugEnabled()) { Log.Debug("Adding to batch:{0}", lineWithParameters); } _currentBatch.Append((System.Data.SqlClient.SqlCommand)Driver.UnwrapDbCommand(batchUpdate)); if (_currentBatch.CountOfCommands >= _batchSize) { ExecuteBatchWithTiming(batchUpdate); } }
public override void AddToBatch(IExpectation expectation) { totalExpectedRowsAffected += expectation.ExpectedRowCount; IDbCommand batchUpdate = CurrentCommand; string lineWithParameters = null; var sqlStatementLogger = Factory.Settings.SqlStatementLogger; if (sqlStatementLogger.IsDebugEnabled || log.IsDebugEnabled) { lineWithParameters = sqlStatementLogger.GetCommandLineWithParameters(batchUpdate); var formatStyle = sqlStatementLogger.DetermineActualStyle(FormatStyle.Basic); lineWithParameters = formatStyle.Formatter.Format(lineWithParameters); currentBatchCommandsLog.Append("command ") .Append(currentBatch.CountOfCommands) .Append(":") .AppendLine(lineWithParameters); } if (log.IsDebugEnabled) { log.Debug("Adding to batch:" + lineWithParameters); } currentBatch.Append((System.Data.SqlClient.SqlCommand)batchUpdate); if (currentBatch.CountOfCommands >= batchSize) { ExecuteBatchWithTiming(batchUpdate); } }