-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: backpatch2142 read notifies or errors that come in asynchronousl…
…y after the ready for query (#2168)
- Loading branch information
1 parent
1747652
commit 4fa2d5b
Showing
3 changed files
with
28 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,7 +291,19 @@ public synchronized void execute(Query query, @Nullable ParameterList parameters | |
LOGGER.log(Level.FINEST, " simple execute, handler={0}, maxRows={1}, fetchSize={2}, flags={3}", | ||
new Object[]{handler, maxRows, fetchSize, flags}); | ||
} | ||
|
||
try { | ||
if (pgStream.hasMessagePending()) { | ||
if (pgStream.peekChar() == 'N') { | ||
pgStream.receiveChar(); | ||
handler.handleWarning(receiveNoticeResponse()); | ||
} else if (pgStream.peekChar() == 'E') { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
davecramer
Author
Member
|
||
pgStream.receiveChar(); | ||
throw receiveErrorResponse(); | ||
} | ||
} | ||
} catch ( IOException ex ) { | ||
throw new SQLException(ex); | ||
} | ||
if (parameters == null) { | ||
parameters = SimpleQuery.NO_PARAMETERS; | ||
} | ||
|
@@ -2312,6 +2324,7 @@ protected void processResults(ResultHandler handler, int flags) throws IOExcepti | |
} | ||
|
||
case 'N': // Notice Response | ||
LOGGER.log(Level.FINEST, " <=BE Notice"); | ||
SQLWarning warning = receiveNoticeResponse(); | ||
handler.handleWarning(warning); | ||
break; | ||
|
@@ -2369,7 +2382,16 @@ && castNonNull(pendingExecuteQueue.peekFirst()).asSimple) { | |
} | ||
} | ||
endQuery = true; | ||
|
||
if (pgStream.hasMessagePending()) { | ||
if (pgStream.peekChar() == 'N') { | ||
pgStream.receiveChar(); | ||
handler.handleWarning(receiveNoticeResponse()); | ||
} | ||
if (pgStream.peekChar() == 'E') { | ||
pgStream.receiveChar(); | ||
handler.handleError(receiveErrorResponse()); | ||
} | ||
} | ||
// Reset the statement name of Parses that failed. | ||
while (!pendingParseQueue.isEmpty()) { | ||
SimpleQuery failedQuery = pendingParseQueue.removeFirst(); | ||
|
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
Sorry the noob question, but why here is using a
else if
and on line2390
is only using only aif
?