Skip to content

Commit

Permalink
Update name for bulk copy batchSize option
Browse files Browse the repository at this point in the history
  • Loading branch information
muskan124947 committed Jan 17, 2025
1 parent fee3149 commit 0f08eba
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,19 +549,19 @@ CallableStatement prepareCall(String sql, int nType, int nConcur, int nHold,
boolean getcacheBulkCopyMetadata();

/**
* Specifies the default batch size for bulk copy operations.
* Specifies the default batch size for bulk copy operations created from batch insert operations.
*
* @param bulkCopyOptionDefaultsBatchSize
* integer value for bulkCopyOptionDefaultsBatchSize.
* @param bulkCopyForBatchInsertBatchSize
* integer value for bulkCopyForBatchInsertBatchSize.
*/
void setBulkCopyOptionDefaultsBatchSize(int bulkCopyOptionDefaultsBatchSize);
void setBulkCopyForBatchInsertBatchSize(int bulkCopyForBatchInsertBatchSize);

/**
* Returns the default batch size for bulk copy operations.
* Returns the default batch size for bulk copy operations created from batch insert operations.
*
* @return integer value for bulkCopyOptionDefaultsBatchSize.
* @return integer value for bulkCopyForBatchInsertBatchSize.
*/
int getBulkCopyOptionDefaultsBatchSize();
int getBulkCopyForBatchInsertBatchSize();

/**
* Specifies the default timeout for bulk copy operations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -981,19 +981,19 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource {
void setUseBulkCopyForBatchInsert(boolean useBulkCopyForBatchInsert);

/**
* Sets the default batch size for Bulk Copy operations.
* Sets the default batch size for bulk copy operations created from batch insert operations.
*
* @param bulkCopyOptionDefaultsBatchSize
* the default batch size for Bulk Copy operations.
* @param bulkCopyForBatchInsertBatchSize
* the default batch size for bulk copy operations created from batch insert operations.
*/
void setBulkCopyOptionDefaultsBatchSize(int bulkCopyOptionDefaultsBatchSize);
void setBulkCopyForBatchInsertBatchSize(int bulkCopyForBatchInsertBatchSize);

/**
* Returns the default batch size for Bulk Copy operations.
* Returns the default batch size for bulk copy operations created from batch insert operations.
*
* @return the default batch size for Bulk Copy operations.
* @return the default batch size for bulk copy operations created from batch insert operations.
*/
int getBulkCopyOptionDefaultsBatchSize();
int getBulkCopyForBatchInsertBatchSize();

/**
* Sets the default timeout for Bulk Copy operations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public SQLServerBulkCopyOptions() {
* Constructs a SQLServerBulkCopySettings class using defaults from given connection
*/
SQLServerBulkCopyOptions(SQLServerConnection conn) {
batchSize = conn.getBulkCopyOptionDefaultsBatchSize();
batchSize = conn.getBulkCopyForBatchInsertBatchSize();
bulkCopyTimeout = conn.getBulkCopyOptionDefaultsTimeout();
checkConstraints = conn.getBulkCopyOptionDefaultsCheckConstraints();
fireTriggers = conn.getBulkCopyOptionDefaultsFireTriggers();
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -856,27 +856,27 @@ public void setUseBulkCopyForBatchInsert(boolean useBulkCopyForBatchInsert) {
}

/**
* The default batch size for bulk copy operations.
* The default batch size for bulk copy operations created from batch insert operations.
*/
private int bulkCopyOptionDefaultsBatchSize = 0;
private int bulkCopyForBatchInsertBatchSize = 0;

/**
* Returns the bulkCopyOptionDefaultsBatchSize value.
* Returns the bulkCopyForBatchInsertBatchSize value.
*
* @return the bulkCopyOptionDefaultsBatchSize value.
* @return the bulkCopyForBatchInsertBatchSize value.
*/
public int getBulkCopyOptionDefaultsBatchSize() {
return bulkCopyOptionDefaultsBatchSize;
public int getBulkCopyForBatchInsertBatchSize() {
return bulkCopyForBatchInsertBatchSize;
}

/**
* Sets the bulkCopyOptionDefaultsBatchSize value.
* Sets the bulkCopyForBatchInsertBatchSize value.
*
* @param bulkCopyOptionDefaultsBatchSize
* the bulkCopyOptionDefaultsBatchSize value to set.
* @param bulkCopyForBatchInsertBatchSize
* the bulkCopyForBatchInsertBatchSize value to set.
*/
public void setBulkCopyOptionDefaultsBatchSize(int bulkCopyOptionDefaultsBatchSize) {
this.bulkCopyOptionDefaultsBatchSize = bulkCopyOptionDefaultsBatchSize;
public void setBulkCopyForBatchInsertBatchSize(int bulkCopyForBatchInsertBatchSize) {
this.bulkCopyForBatchInsertBatchSize = bulkCopyForBatchInsertBatchSize;
}

/**
Expand Down Expand Up @@ -3336,10 +3336,10 @@ else if (0 == requestedPacketSize)
useBulkCopyForBatchInsert = isBooleanPropertyOn(sPropKey, sPropValue);
}

sPropKey = SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_BATCH_SIZE.toString();
sPropKey = SQLServerDriverIntProperty.BULK_COPY_FOR_BATCH_INSERT_BATCH_SIZE.toString();
sPropValue = activeConnectionProperties.getProperty(sPropKey);
if (null != sPropValue) {
bulkCopyOptionDefaultsBatchSize = Integer.parseInt(sPropValue);
bulkCopyForBatchInsertBatchSize = Integer.parseInt(sPropValue);
}

sPropKey = SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_TIMEOUT.toString();
Expand Down Expand Up @@ -7901,8 +7901,8 @@ public <T> T unwrap(Class<T> iface) throws SQLException {
/** original useBulkCopyForBatchInsert flag */
private boolean originalUseBulkCopyForBatchInsert;

/** original bulkCopyOptionDefaultsBatchSize */
private int originalBulkCopyOptionDefaultsBatchSize;
/** original bulkCopyForBatchInsertBatchSize */
private int originalBulkCopyForBatchInsertBatchSize;

/** original bulkCopyOptionDefaultsTimeout */
private int originalBulkCopyOptionDefaultsTimeout;
Expand Down Expand Up @@ -7963,7 +7963,7 @@ void beginRequestInternal() throws SQLException {
originalEnablePrepareOnFirstPreparedStatementCall = getEnablePrepareOnFirstPreparedStatementCall();
originalSCatalog = sCatalog;
originalUseBulkCopyForBatchInsert = getUseBulkCopyForBatchInsert();
originalBulkCopyOptionDefaultsBatchSize = getBulkCopyOptionDefaultsBatchSize();
originalBulkCopyForBatchInsertBatchSize = getBulkCopyForBatchInsertBatchSize();
originalBulkCopyOptionDefaultsTimeout = getBulkCopyOptionDefaultsTimeout();
originalBulkCopyOptionDefaultsCheckConstraints = getBulkCopyOptionDefaultsCheckConstraints();
originalBulkCopyOptionDefaultsFireTriggers = getBulkCopyOptionDefaultsFireTriggers();
Expand Down Expand Up @@ -8034,8 +8034,8 @@ void endRequestInternal() throws SQLException {
setUseBulkCopyForBatchInsert(originalUseBulkCopyForBatchInsert);
}

if (getBulkCopyOptionDefaultsBatchSize() != originalBulkCopyOptionDefaultsBatchSize) {
setBulkCopyOptionDefaultsBatchSize(originalBulkCopyOptionDefaultsBatchSize);
if (getBulkCopyForBatchInsertBatchSize() != originalBulkCopyForBatchInsertBatchSize) {
setBulkCopyForBatchInsertBatchSize(originalBulkCopyForBatchInsertBatchSize);
}

if (getBulkCopyOptionDefaultsTimeout() != originalBulkCopyOptionDefaultsTimeout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,27 +755,27 @@ public void setUseBulkCopyForBatchInsert(boolean useBulkCopyForBatchInsert) {
}

/**
* The default batch size for bulk copy operations.
* The default batch size for bulk copy operations created from batch insert operations.
*/
private int bulkCopyOptionDefaultsBatchSize = 0;
private int bulkCopyForBatchInsertBatchSize = 0;

/**
* Returns the bulkCopyOptionDefaultsBatchSize value.
* Returns the bulkCopyForBatchInsertBatchSize value.
*
* @return the bulkCopyOptionDefaultsBatchSize value.
* @return the bulkCopyForBatchInsertBatchSize value.
*/
public int getBulkCopyOptionDefaultsBatchSize() {
return wrappedConnection.getBulkCopyOptionDefaultsBatchSize();
public int getBulkCopyForBatchInsertBatchSize() {
return wrappedConnection.getBulkCopyForBatchInsertBatchSize();

Check warning on line 768 in src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java#L768

Added line #L768 was not covered by tests
}

/**
* Sets the bulkCopyOptionDefaultsBatchSize value.
* Sets the bulkCopyForBatchInsertBatchSize value.
*
* @param bulkCopyOptionDefaultsBatchSize
* the bulkCopyOptionDefaultsBatchSize value to set.
* @param bulkCopyForBatchInsertBatchSize
* the bulkCopyForBatchInsertBatchSize value to set.
*/
public void setBulkCopyOptionDefaultsBatchSize(int bulkCopyOptionDefaultsBatchSize) {
wrappedConnection.setBulkCopyOptionDefaultsBatchSize(bulkCopyOptionDefaultsBatchSize);
public void setBulkCopyForBatchInsertBatchSize(int bulkCopyForBatchInsertBatchSize) {
wrappedConnection.setBulkCopyForBatchInsertBatchSize(bulkCopyForBatchInsertBatchSize);
}

Check warning on line 779 in src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java#L778-L779

Added lines #L778 - L779 were not covered by tests

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,16 +1026,16 @@ public boolean getUseBulkCopyForBatchInsert() {
}

@Override
public void setBulkCopyOptionDefaultsBatchSize(int bulkCopyOptionDefaultsBatchSize) {
setIntProperty(connectionProps, SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_BATCH_SIZE.toString(),
bulkCopyOptionDefaultsBatchSize);
public void setBulkCopyForBatchInsertBatchSize(int bulkCopyForBatchInsertBatchSize) {
setIntProperty(connectionProps, SQLServerDriverIntProperty.BULK_COPY_FOR_BATCH_INSERT_BATCH_SIZE.toString(),

Check warning on line 1030 in src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java#L1030

Added line #L1030 was not covered by tests
bulkCopyForBatchInsertBatchSize);
}

Check warning on line 1032 in src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java#L1032

Added line #L1032 was not covered by tests

@Override
public int getBulkCopyOptionDefaultsBatchSize() {
public int getBulkCopyForBatchInsertBatchSize() {
return getIntProperty(connectionProps,
SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_BATCH_SIZE.toString(),
SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_BATCH_SIZE.getDefaultValue());
SQLServerDriverIntProperty.BULK_COPY_FOR_BATCH_INSERT_BATCH_SIZE.toString(),
SQLServerDriverIntProperty.BULK_COPY_FOR_BATCH_INSERT_BATCH_SIZE.getDefaultValue());

Check warning on line 1038 in src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java#L1036-L1038

Added lines #L1036 - L1038 were not covered by tests
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ enum SQLServerDriverIntProperty {
CANCEL_QUERY_TIMEOUT("cancelQueryTimeout", -1),
CONNECT_RETRY_COUNT("connectRetryCount", 1, 0, 255),
CONNECT_RETRY_INTERVAL("connectRetryInterval", 10, 1, 60),
BULK_COPY_OPTION_DEFAULTS_BATCH_SIZE("bulkCopyOptionDefaultsBatchSize", 0),
BULK_COPY_FOR_BATCH_INSERT_BATCH_SIZE("bulkCopyForBatchInsertBatchSize", 0),
BULK_COPY_OPTION_DEFAULTS_TIMEOUT("bulkCopyOptionDefaultsTimeout", 60);

private final String name;
Expand Down Expand Up @@ -955,8 +955,8 @@ static String getAppName() {
new SQLServerDriverPropertyInfo(SQLServerDriverBooleanProperty.USE_BULK_COPY_FOR_BATCH_INSERT.toString(),
Boolean.toString(SQLServerDriverBooleanProperty.USE_BULK_COPY_FOR_BATCH_INSERT.getDefaultValue()),
false, TRUE_FALSE),
new SQLServerDriverPropertyInfo(SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_BATCH_SIZE.toString(),
Integer.toString(SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_BATCH_SIZE.getDefaultValue()),false, null),
new SQLServerDriverPropertyInfo(SQLServerDriverIntProperty.BULK_COPY_FOR_BATCH_INSERT_BATCH_SIZE.toString(),
Integer.toString(SQLServerDriverIntProperty.BULK_COPY_FOR_BATCH_INSERT_BATCH_SIZE.getDefaultValue()),false, null),
new SQLServerDriverPropertyInfo(SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_TIMEOUT.toString(),
Integer.toString(SQLServerDriverIntProperty.BULK_COPY_OPTION_DEFAULTS_TIMEOUT.getDefaultValue()),false, null),
new SQLServerDriverPropertyInfo(SQLServerDriverBooleanProperty.BULK_COPY_OPTION_DEFAULTS_CHECK_CONSTRAINTS.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ protected Object[][] getContents() {
{"R_cancelQueryTimeoutPropertyDescription", "The number of seconds to wait to cancel sending a query timeout."},
{"R_invalidCancelQueryTimeout", "The cancel timeout value {0} is not valid."},
{"R_useBulkCopyForBatchInsertPropertyDescription", "Determines whether the driver will use bulk copy API for batch insert operations."},
{"R_bulkCopyOptionDefaultsBatchSizePropertyDescription", "The default batch size for bulk copy operations."},
{"R_bulkCopyForBatchInsertBatchSizePropertyDescription", "The default batch size for bulk copy operations created from batch insert operations."},
{"R_bulkCopyOptionDefaultsTimeoutPropertyDescription", "The default timeout for bulk copy operations."},
{"R_bulkCopyOptionDefaultsCheckConstraintsPropertyDescription", "Determines whether to check constraints during bulk copy operations."},
{"R_bulkCopyOptionDefaultsFireTriggersPropertyDescription", "Determines whether to fire triggers during bulk copy operations."},
Expand Down
Loading

0 comments on commit 0f08eba

Please sign in to comment.