-
Notifications
You must be signed in to change notification settings - Fork 434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] PreparedStatement.executeBatch() When the Insert Sql Column Name Case Mismatch, Throws BatchUpdateException "Unable to retrieve column metadata." #2589
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix imports and test cleanup
- Add test case for matching column case in batch execution - Add test case for mismatched column case in batch execution, expected SQLServerException
- Update column index search to be case-insensitive in SQLServerPreparedStatement - Remove failing test case in BatchExecutionTest that was checking for specific exception
719687f
to
902ac88
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something to consider:
Does your database use a case-sensitive (like SQL_Latin1_General_CP1_CS_AS) or case-insensitive collation (like SQL_Latin1_General_CP1_CI_AS)?
What happens if you are using a case-sensitive collation and a table like this?
create table [Test1] ([C1] int, [c1] varchar)
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
Outdated
Show resolved
Hide resolved
- Add getIsCaseSensitive() method to SQLCollation class - Update SQLServerPreparedStatement to use case sensitivity information - Improve performance by avoiding unnecessary case-insensitive comparisons
Good idea. I covered the unit tests that use both columns c1 and C1, and an exception occurred, indicating that no one has ever covered CS before. I'll try to fix it by the way.
|
- Add support for case-sensitive column names in SQLServerBulkBatchInsertRecord - Update SQLServerBulkRecord to handle case sensitivity in column metadata - Modify SQLServerPreparedStatement to pass case sensitivity information to batch records - Add tests for case-sensitive and case-insensitive column name handling in batch execution
ae48902
to
2d3f115
Compare
/azp run |
Commenter does not have sufficient privileges for PR 2589 in repo microsoft/mssql-jdbc |
/azp run |
Commenter does not have sufficient privileges for PR 2589 in repo microsoft/mssql-jdbc |
…abase in unit test.
aebf086
to
6408cc4
Compare
@lilgreenbird |
fix #2588 [BUG] PreparedStatement.executeBatch() When the Insert Sql Column Name Case Mismatch, Throws BatchUpdateException "Unable to retrieve column metadata."