-
Notifications
You must be signed in to change notification settings - Fork 285
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
Add | Add RowsCopied64 property, refs, and docs #2004
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2004 +/- ##
==========================================
- Coverage 70.58% 69.91% -0.68%
==========================================
Files 306 305 -1
Lines 61722 61795 +73
==========================================
- Hits 43569 43206 -363
- Misses 18153 18589 +436
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
@@ -509,9 +509,30 @@ and faster to use a Transact-SQL `INSERT … SELECT` statement to copy the data. | |||
This value is incremented during the <xref:Microsoft.Data.SqlClient.SqlBulkCopy.SqlRowsCopied> event and does not imply that this number of rows has been sent to the server or committed. | |||
|
|||
This value can be accessed during or after the execution of a bulk copy operation. | |||
|
|||
This value can become negative if the number of rows exceelds int.MaxValue. If this may happen use the RowsCopied64 property. |
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.
exceelds
->exceeds
(typo)RowsCopied64
should have some kind of ref tag?- I feel like this language should be stronger: "This value will wrap around and become negative if... Applications should use RowsCopied64 instead".
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.
Changed to:
This value will wrap around and become negative if the number of rows exceeds int.MaxValue. Consider using the <xref:Microsoft.Data.SqlClient.SqlBulkCopy.RowsCopied64> property.
If the tone needs to be stronger than that I'll leave the exact wording to the MS team.
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.
I like your rewording. As an app developer I would just always use RowsCopied64 now that it exists since there's no cost and real upside.
a098c78
to
c065dbb
Compare
LGTM, Is it possible to add some tests as well? |
Possible, yes. But why? it's a tiny property with an entirely obvious implementation. |
We are trying to improve the code coverage and each line of new code added with no test will cause some shortage in the code coverage percentage. That is the only reason. |
I've altered the two existing tests which cover RowsCopied to also check RowsCopied64. |
Closes #2001
Changes the
SqlBulkCopy._rowscopied
variable to a long and adds a newlong SqlBulkCopy.RowsCopied64
property to the class.The existing
int SqlBulkCopy.RowsCopied
behaviour of going negative is preserved. I have changed the implementation to beunchecked((int)_rowsCopied);
to make it clear in the source that the unchecked behaviour is deliberate. The unchecked is not strictly required because it is the default compile option.Is keeping the existing behaviour desiable? It could be changed to throw an overflow exception. Keeping the existing behaviour is most compatible in case someone has taken a dependency on the existing behaviour. It is not the most correct.