From c620a6366abe33d7834b1fb7bfb7c1fceb741556 Mon Sep 17 00:00:00 2001 From: ashitsalesforce Date: Sat, 18 Jan 2025 14:03:16 -0800 Subject: [PATCH] minor fix to the logic to handle IN clause with filename and column name minor fix to the logic to handle IN clause with filename and column name --- .../action/visitor/AbstractQueryVisitor.java | 9 ++++++--- .../dataloader/process/ProcessExtractTestBase.java | 12 ------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java b/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java index 51215147..1f64170f 100644 --- a/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java +++ b/src/main/java/com/salesforce/dataloader/action/visitor/AbstractQueryVisitor.java @@ -89,11 +89,14 @@ public AbstractQueryVisitor(AbstractExtractAction action, Controller controller, this.action = action; } + private boolean isGetSoqlMethodCalledOnce = false; @Override public final void visit() throws DataAccessObjectException, OperationException { + isGetSoqlMethodCalledOnce = false; try { if (getProgressMonitor().isCanceled()) return; String soql = getSoqlForNextBatch(); + isGetSoqlMethodCalledOnce = true; while (soql != null) { final int size = executeQuery(soql); if (size == 0) { @@ -132,7 +135,6 @@ protected boolean writeStatus() { private CSVFileReader csvReader = null; private String inClauseColName = null; private int numRows = 0; - private boolean isGetSoqlForNextBatchCalled = false; private int maxSoqlCharLength = DEFAULT_MAX_SOQL_CHAR_LENGTH; private String getSoqlForNextBatch() throws OperationException { List inClauseFileAndColumnNameList = parseInClauseForFileAndColumnName(soql); @@ -182,10 +184,11 @@ private String getSoqlForNextBatch() throws OperationException { csvReader = null; } return batchSoql; - } else if (!isGetSoqlForNextBatchCalled) { - isGetSoqlForNextBatchCalled = true; + } else if (!isGetSoqlMethodCalledOnce) { + // return the full soql for the first time return soql; } else { + // return null to indicate that there are no more batches return null; } } diff --git a/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java b/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java index 2173c868..feb723a8 100644 --- a/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java +++ b/src/test/java/com/salesforce/dataloader/process/ProcessExtractTestBase.java @@ -59,18 +59,6 @@ public ProcessExtractTestBase(Map config) { super(config); } - @Parameterized.Parameters(name = "{0}") - public static Collection getParameters() { - return Arrays.asList( - // partner API - TestVariant.forSettings(TestSetting.BULK_API_DISABLED, TestSetting.BULK_V2_API_DISABLED) - // Bulk API - , TestVariant.forSettings(TestSetting.BULK_API_ENABLED, TestSetting.BULK_V2_API_DISABLED) - // Bulk V2 Query API - , TestVariant.forSettings(TestSetting.BULK_V2_API_ENABLED) - ); - } - protected class ExtractContactGenerator extends ContactGenerator { private final String uniqueLastName;