Search in sources :

Example 1 with OracleSelectQuery

use of com.hortonworks.registries.storage.impl.jdbc.provider.oracle.query.OracleSelectQuery in project registry by hortonworks.

the class OracleExecutor 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), ORACLE_DATA_TYPE_CONTEXT, new OracleSelectQuery(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);
        }
    }
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) CaseAgnosticStringSet(com.hortonworks.registries.storage.impl.jdbc.util.CaseAgnosticStringSet) SQLException(java.sql.SQLException) Connection(java.sql.Connection) ExecutionConfig(com.hortonworks.registries.storage.impl.jdbc.config.ExecutionConfig) OracleSelectQuery(com.hortonworks.registries.storage.impl.jdbc.provider.oracle.query.OracleSelectQuery)

Aggregations

ExecutionConfig (com.hortonworks.registries.storage.impl.jdbc.config.ExecutionConfig)1 OracleSelectQuery (com.hortonworks.registries.storage.impl.jdbc.provider.oracle.query.OracleSelectQuery)1 CaseAgnosticStringSet (com.hortonworks.registries.storage.impl.jdbc.util.CaseAgnosticStringSet)1 Connection (java.sql.Connection)1 ResultSetMetaData (java.sql.ResultSetMetaData)1 SQLException (java.sql.SQLException)1