-
Notifications
You must be signed in to change notification settings - Fork 421
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 for Clobs/NClobs not persisting after RS/Connection closes #682
Conversation
Retry logic
To help debug an irreproducable/random mismatch error if it occurs in the future.
…#666) * Dont throw exception for colmetadata token * Adding a comment * Update comment * Adding a warning message * remove ignoreLengthPrefixedToken
* Added more information to error messages To help debug an irreproducable/random mismatch error if it occurs in the future. * Revert "Added information to error message" This reverts commit 25301e6. * Fix for microsoft#659 Added error handling logic for special cases. * Read message length Read the message length instead of reading until terminating character * Unsigned byte update Message length is an unsigned byte, converting before using. * Removed clunky hex conversions convert the byte straight to an int and use existing constants instead of making new ones * Narrowed trigger conditions fixed an issue where column names who had the hex token 'AA' would cause an error to be thrown. * Spacing fixes * Added test case * spacing adjustment * Edited test drop procedures Changed IF EXISTS DROP commands to be compatible with sql server 2008 * github spacing misalignment fixes * Changed test condition now only runs on compatible database or higher * Removed error check Removed a previous implementation in favor of one that changes the TDS parser * tdsreader change * removing test for now * enabled tests * github spacing fix * removed array import * removed "arrays" instead of "array" * spacing changes
Implement a more generic and compatible test in the future
Used in removed test
# Conflicts: # pom.xml
Codecov Report
@@ Coverage Diff @@
## dev #682 +/- ##
============================================
- Coverage 48.17% 48.15% -0.02%
- Complexity 2585 2587 +2
============================================
Files 113 114 +1
Lines 26572 26577 +5
Branches 4450 4452 +2
============================================
- Hits 12801 12799 -2
- Misses 11634 11639 +5
- Partials 2137 2139 +2
Continue to review full report at Codecov.
|
getterStream = new BufferedReader(new InputStreamReader(inputStream, UTF_16LE)); | ||
} | ||
else { | ||
getStringFromStream(); |
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.
Calling getStringFromStream()
here is not required. Lets remove it from here.
@@ -312,10 +306,23 @@ public String getSubString(long pos, | |||
public long length() throws SQLException { | |||
checkClosed(); | |||
|
|||
if (value == null && activeStreams.get(0) instanceof PLPInputStream) { | |||
return (long)((PLPInputStream)activeStreams.get(0)).payloadLength/2; | |||
} | |||
getStringFromStream(); |
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.
If value
is NULL, code doesn't reach here, and if it is NOT NULL, calling getStringFromStream()
is not needed.
@@ -243,7 +243,7 @@ public long length() throws SQLException { | |||
* Function for the result set to maintain blobs it has created | |||
* @throws SQLException | |||
*/ | |||
void fillByteArray() throws SQLException { | |||
void fillFromStream() throws SQLException { |
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.
Let's make fillFromStream()
part of Interface that can be implemented by SQLServerBlob
, SQLServerClob
and SQLServerNClob
classes and can be declared type for activeLOB
in ResultSet.
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.
Added an abstract base class for blob/clob/nclob. Includes an abstract function fillFromStream which the child classes inherit and override.
Created an abstract class with a shared method between Blobs/Clobs/NClobs. More functionality can be moved to this class, but the functions will have their visibility increased to package level.
try { | ||
((SQLServerBlob)activeBlob).fillByteArray(); | ||
((SQLServerBlob)activeLOB).fillFromStream(); |
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.
About the errors, we should throw an appropriate error message instead of logging it, from our resources file
The ASCII stream functionality did not work, removed for now. Added streaming functionality to character streams. Junit tests for streams to come at a later date.