use of com.hortonworks.registries.storage.impl.jdbc.provider.sql.query.SqlSelectQuery in project registry by hortonworks.
the class AbstractQueryExecutor method getColumnNames.
@Override
public CaseAgnosticStringSet getColumnNames(String namespace) throws SQLException {
CaseAgnosticStringSet columns = new CaseAgnosticStringSet();
Connection connection = null;
try {
connection = getConnection();
final ResultSetMetaData rsMetadata = PreparedStatementBuilder.of(connection, new ExecutionConfig(queryTimeoutSecs), storageDataTypeContext, new SqlSelectQuery(namespace)).getMetaData();
for (int i = 1; i <= rsMetadata.getColumnCount(); i++) {
columns.add(rsMetadata.getColumnName(i));
}
return columns;
} catch (SQLException e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (!transactionBookKeeper.hasActiveTransaction(Thread.currentThread().getId())) {
closeConnection(connection);
}
}
}
Aggregations