Skip to content

Commit

Permalink
Proposed fix fo microsoft#1661 (microsoft#1662)
Browse files Browse the repository at this point in the history
* try to solve microsoft#1661

* Update tdsparser.java

Fine tuned fix.

* Update tdsparser.java

Updated formatting

Co-authored-by: Milan Mimica <milan.mimica@infobip.com>
Co-authored-by: Wei Zhang <53021889+v-zhangw@users.noreply.github.com>
  • Loading branch information
3 people authored and lilgreenbird committed Dec 1, 2021
1 parent a901c34 commit 5f100f9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/com/microsoft/sqlserver/jdbc/tdsparser.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,14 @@ boolean onOrder(TDSReader tdsReader) throws SQLServerException {
}

boolean onColMetaData(TDSReader tdsReader) throws SQLServerException {
// SHOWPLAN might be ON, instead of throwing an exception, ignore the column meta data
if (logger.isLoggable(Level.SEVERE))
logger.severe(tdsReader.toString() + ": " + logContext + ": Encountered "
+ TDS.getTokenName(tdsReader.peekTokenType()) + ". SHOWPLAN is ON, ignoring.");
/*
* SHOWPLAN or something else that produces extra metadata might be ON. instead of throwing an exception, warn
* and discard the column meta data
*/
if (logger.isLoggable(Level.WARNING))
logger.warning(tdsReader.toString() + ": " + logContext + ": Discarding unexpected "
+ TDS.getTokenName(tdsReader.peekTokenType()));
(new StreamColumns(false)).setFromTDS(tdsReader);
return false;
}

Expand Down

0 comments on commit 5f100f9

Please sign in to comment.