From: <aye...@us...> - 2009-05-13 16:35:42
|
Revision: 4291 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4291&view=rev Author: ayenderahien Date: 2009-05-13 16:35:33 +0000 (Wed, 13 May 2009) Log Message: ----------- fixing issue with batcher only really batching when log is enabled Modified Paths: -------------- trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs Modified: trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs =================================================================== --- trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs 2009-05-13 16:08:36 UTC (rev 4290) +++ trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs 2009-05-13 16:35:33 UTC (rev 4291) @@ -19,10 +19,7 @@ { batchSize = Factory.Settings.AdoBatchSize; currentBatch = new SqlClientSqlCommandSet(); - if (log.IsDebugEnabled) - { - currentBatchCommandsLog = new StringBuilder(); - } + currentBatchCommandsLog = new StringBuilder(); } public override int BatchSize @@ -35,23 +32,20 @@ { totalExpectedRowsAffected += expectation.ExpectedRowCount; IDbCommand batchUpdate = CurrentCommand; - if (log.IsDebugEnabled) + + if (log.IsDebugEnabled || Factory.Settings.SqlStatementLogger.IsDebugEnabled) { string lineWithParameters = Factory.Settings.SqlStatementLogger.GetCommandLineWithParameters(batchUpdate); + currentBatchCommandsLog.Append("Batch command: ").AppendLine(lineWithParameters); if (Factory.Settings.SqlStatementLogger.IsDebugEnabled) { Factory.Settings.SqlStatementLogger.LogCommand("Adding to batch:", batchUpdate, FormatStyle.Basic); } - else + else if (log.IsDebugEnabled) { log.Debug("Adding to batch:" + lineWithParameters); } - currentBatchCommandsLog.Append("Batch command: ").AppendLine(lineWithParameters); } - else - { - Factory.Settings.SqlStatementLogger.LogCommand(batchUpdate, FormatStyle.Basic); - } currentBatch.Append((System.Data.SqlClient.SqlCommand)batchUpdate); if (currentBatch.CountOfCommands >= batchSize) { @@ -64,11 +58,11 @@ log.Debug("Executing batch"); CheckReaders(); Prepare(currentBatch.BatchCommand); - if (log.IsDebugEnabled) + if (log.IsDebugEnabled || Factory.Settings.SqlStatementLogger.IsDebugEnabled) { if (Factory.Settings.SqlStatementLogger.IsDebugEnabled) Factory.Settings.SqlStatementLogger.LogBatchCommand(currentBatchCommandsLog.ToString()); - else + else if (log.IsDebugEnabled) log.Debug(currentBatchCommandsLog.ToString()); currentBatchCommandsLog = new StringBuilder(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |