[FIX] PreparedStatement.executeBatch() When the Insert Sql Column Name Case Mismatch, Throws BatchUpdateException "Unable to retrieve column metadata."#2589
Conversation
|
@microsoft-github-policy-service agree |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
lilgreenbird
left a comment
There was a problem hiding this comment.
fix imports and test cleanup
719687f to
902ac88
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
David-Engel
left a comment
There was a problem hiding this comment.
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). |
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. |
|
@Jeffery-Wasty , who can continue?
|
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@Jeffery-Wasty ,pipelines error. is it necessary to rebase main? the pipeline does in the code repository. |
|
@wooln This needs to be resolved on our end. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
@Jeffery-Wasty ,Oops, CI is still in error. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@Jeffery-Wasty @machavan , CI is stilllll in error. |
- 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
- Add getIsCaseSensitive() method to SQLCollation class - Update SQLServerPreparedStatement to use case sensitivity information - Improve performance by avoiding unnecessary case-insensitive comparisons
- 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
…port in BatchExecutionTest
…abase in unit test.
6408cc4 to
0a77577
Compare
|
@machavan, Needs review. I've rebased main. What else do I need to do? |
|
Hi @wooln, We will review and get back on this PR. Thanks |
|
|
||
| SQLServerBulkBatchInsertRecord batchRecord = new SQLServerBulkBatchInsertRecord( | ||
| batchParamValues, bcOperationColumnList, bcOperationValueList, null); | ||
| batchParamValues, bcOperationColumnList, bcOperationValueList, null, connection.getDatabaseCollation().getIsCaseSensitive()); |
There was a problem hiding this comment.
is databaseCollation always non-null and populated in Connection object ?( without involving an explicit round-trip)
There was a problem hiding this comment.
At least in this place, the connection has opened and the collation has obtained.
To be prudent, the database in the connection string and the table operated on in the Statement may not necessarily be the same database (because the table name in SQL can have a database name prefix). I don't know how to deal with it.
- Return false (case-insensitive) if sortOrder is not found
fix #2588 [BUG] PreparedStatement.executeBatch() When the Insert Sql Column Name Case Mismatch, Throws BatchUpdateException "Unable to retrieve column metadata."