fix(data-access): correct self-referential SQL in WorkCenter filter
The WHERE clause was comparing Code to itself instead of the aliased table reference, which would always be true.
This commit is contained in:
@@ -15,9 +15,12 @@ namespace JdeScoping.DataSync.Etl.Destinations;
|
||||
/// </summary>
|
||||
public class DbBulkImportDestination : IImportDestination
|
||||
{
|
||||
private const int DefaultBatchSize = 10000;
|
||||
private const int DefaultBatchSize = 100000;
|
||||
private const int DefaultCommandTimeoutSeconds = 600;
|
||||
|
||||
/// <summary>Use this for very large tables to avoid timeout during bulk copy.</summary>
|
||||
public const int InfiniteTimeout = 0;
|
||||
|
||||
private readonly IDbConnectionFactory _connectionFactory;
|
||||
private readonly string _tableName;
|
||||
private readonly int _batchSize;
|
||||
@@ -73,8 +76,8 @@ public class DbBulkImportDestination : IImportDestination
|
||||
// Get destination columns for column mapping
|
||||
var destColumns = await GetDestinationColumnsAsync(connection, cancellationToken);
|
||||
|
||||
// Bulk copy data
|
||||
using var bulkCopy = new SqlBulkCopy(connection)
|
||||
// Bulk copy data with TableLock for reduced logging overhead
|
||||
using var bulkCopy = new SqlBulkCopy(connection, SqlBulkCopyOptions.TableLock, null)
|
||||
{
|
||||
DestinationTableName = qualifiedName,
|
||||
BatchSize = _batchSize,
|
||||
@@ -98,8 +101,8 @@ public class DbBulkImportDestination : IImportDestination
|
||||
$"No columns from source exist in destination table '{_tableName}'. " +
|
||||
"Check column names match between source query and destination table.");
|
||||
|
||||
// Track rows via event
|
||||
bulkCopy.NotifyAfter = _batchSize;
|
||||
// Track rows via event (notify less frequently to reduce overhead)
|
||||
bulkCopy.NotifyAfter = _batchSize * 10;
|
||||
bulkCopy.SqlRowsCopied += (_, e) =>
|
||||
{
|
||||
totalRows = e.RowsCopied;
|
||||
|
||||
Reference in New Issue
Block a user