public override void AddToBatch(IExpectation expectation) { _totalExpectedRowsAffected += expectation.ExpectedRowCount; var batchUpdate = CurrentCommand; Driver.AdjustCommand(batchUpdate); var sqlStatementLogger = Factory.Settings.SqlStatementLogger; if (sqlStatementLogger.IsDebugEnabled) { var lineWithParameters = sqlStatementLogger.GetCommandLineWithParameters(batchUpdate); var formatStyle = sqlStatementLogger.DetermineActualStyle(FormatStyle.Basic); lineWithParameters = formatStyle.Formatter.Format(lineWithParameters); _currentBatchCommandsLog.Append("command ") .Append(_currentBatch.CountOfCommands) .Append(":") .AppendLine(lineWithParameters); } var update = batchUpdate as ProfiledSqlDbCommand; if (update != null) { _currentBatch.Append(update.SqlCommand); } else { _currentBatch.Append((SqlCommand)batchUpdate); } if (_currentBatch.CountOfCommands >= _batchSize) { ExecuteBatchWithTiming(batchUpdate); } }
public override void AddToBatch(IExpectation expectation) { totalExpectedRowsAffected += expectation.ExpectedRowCount; var 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(((ProfiledSqlDbCommand)batchUpdate).Command); if (currentBatch.CountOfCommands >= batchSize) { ExecuteBatchWithTiming(batchUpdate); } }