-
-
Save jjl/7cbbebdf8268baa66222fdf476974aa3 to your computer and use it in GitHub Desktop.
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
public ResultSetMetaData getMetaData() throws SQLException { | |
checkClosed(); | |
ResultSet rs = getResultSet(); | |
if (rs == null || ((PgResultSet) rs).isResultSetClosed()) { | |
// OK, we haven't executed it yet, or it was closed | |
// we've got to go to the backend | |
// for more info. We send the full query, but just don't | |
// execute it. | |
int flags = QueryExecutor.QUERY_ONESHOT | QueryExecutor.QUERY_DESCRIBE_ONLY | |
| QueryExecutor.QUERY_SUPPRESS_BEGIN; | |
StatementResultHandler handler = new StatementResultHandler(); | |
connection.getQueryExecutor().execute(preparedQuery.query, preparedParameters, handler, 0, 0, | |
flags); | |
ResultWrapper wrapper = handler.getResults(); | |
if (wrapper != null) { | |
rs = wrapper.getResultSet(); | |
} | |
} | |
if (rs != null) { | |
return rs.getMetaData(); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment