-
Notifications
You must be signed in to change notification settings - Fork 426
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
Added support to read SQL Warnings after ResultSet is read completely #785
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -856,7 +856,7 @@ final void doExecuteStatement(StmtExecCmd execCmd) throws SQLServerException { | |
// Start the response | ||
ensureExecuteResultsReader(execCmd.startResponse(isResponseBufferingAdaptive)); | ||
startResults(); | ||
getNextResult(); | ||
getNextResult(true); | ||
} | ||
|
||
// If execution produced no result set, then throw an exception if executeQuery() was used. | ||
|
@@ -923,7 +923,7 @@ private void doExecuteStatementBatch(StmtBatchExecCmd execCmd) throws SQLServerE | |
// Start the response | ||
ensureExecuteResultsReader(execCmd.startResponse(isResponseBufferingAdaptive)); | ||
startResults(); | ||
getNextResult(); | ||
getNextResult(true); | ||
|
||
// If execution produced a result set, then throw an exception | ||
if (null != resultSet) { | ||
|
@@ -1277,7 +1277,7 @@ final void processResults() throws SQLServerException { | |
while (moreResults) { | ||
// Get the next result | ||
try { | ||
getNextResult(); | ||
getNextResult(true); | ||
} catch (SQLServerException e) { | ||
// If an exception is thrown while processing the results | ||
// then decide what to do with it: | ||
|
@@ -1327,7 +1327,7 @@ public final boolean getMoreResults() throws SQLServerException { | |
// Get the next result, whatever it is (ResultSet or update count). | ||
// Don't just return the value from the getNextResult() call, however. | ||
// The getMoreResults method has a subtle spec for its return value (see above). | ||
getNextResult(); | ||
getNextResult(true); | ||
loggerExternal.exiting(getClassNameLogging(), "getMoreResults", null != resultSet); | ||
return null != resultSet; | ||
} | ||
|
@@ -1368,7 +1368,7 @@ final void clearLastResult() { | |
* | ||
* @return true if another result (ResultSet or update count) was available; false if there were no more results. | ||
*/ | ||
final boolean getNextResult() throws SQLServerException { | ||
final boolean getNextResult(boolean clearFlag) throws SQLServerException { | ||
/** | ||
* TDS response token stream handler used to locate the next result in the TDS response token stream. | ||
*/ | ||
|
@@ -1591,8 +1591,9 @@ boolean onInfo(TDSReader tdsReader) throws SQLServerException { | |
return false; | ||
} | ||
|
||
// Clear out previous results | ||
clearLastResult(); | ||
// Clear out previous results only when clearFlag = true | ||
if (clearFlag) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add brackets even if there's only one line in the if statement |
||
clearLastResult(); | ||
|
||
// If there are no more results, then we're done. | ||
// All we had to do was to close out the previous results. | ||
|
@@ -1786,7 +1787,7 @@ public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQL | |
// If there are not enough results (update counts) to satisfy the number of batches, | ||
// then bail, leaving EXECUTE_FAILED in the remaining slots of the update count array. | ||
startResults(); | ||
if (!getNextResult()) | ||
if (!getNextResult(true)) | ||
break; | ||
} | ||
|
||
|
@@ -1863,7 +1864,7 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio | |
// If there are not enough results (update counts) to satisfy the number of batches, | ||
// then bail, leaving EXECUTE_FAILED in the remaining slots of the update count array. | ||
startResults(); | ||
if (!getNextResult()) | ||
if (!getNextResult(true)) | ||
break; | ||
} | ||
|
||
|
@@ -1997,7 +1998,7 @@ private void doExecuteCursored(StmtExecCmd execCmd, String sql) throws SQLServer | |
|
||
ensureExecuteResultsReader(execCmd.startResponse(isResponseBufferingAdaptive)); | ||
startResults(); | ||
getNextResult(); | ||
getNextResult(true); | ||
} | ||
|
||
/* JDBC 3.0 */ | ||
|
@@ -2182,7 +2183,7 @@ public final ResultSet getGeneratedKeys() throws SQLServerException { | |
// Generated keys are returned in a ResultSet result right after the update count. | ||
// Try to get that ResultSet. If there are no more results after the update count, | ||
// or if the next result isn't a ResultSet, then something is wrong. | ||
if (!getNextResult() || null == resultSet) { | ||
if (!getNextResult(true) || null == resultSet) { | ||
SQLServerException.makeFromDriverError(connection, this, | ||
SQLServerException.getErrString("R_statementMustBeExecuted"), null, false); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Modify javadoc now that clearFlag is a parameter
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.
Done