Example usage for javax.sql.rowset CachedRowSet close

List of usage examples for javax.sql.rowset CachedRowSet close

Introduction

In this page you can find the example usage for javax.sql.rowset CachedRowSet close.

Prototype

void close() throws SQLException;

Source Link

Document

Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

Usage

From source file:uk.ac.ox.it.ords.api.database.structure.services.impl.hibernate.StructureServiceImpl.java

protected String tableComment(String databaseName, String databaseServer, String tableName) throws Exception {
    log.debug("tableComment");
    // obj_description gives the comment for an object, but needs the unique
    // oid for that object. To find the oid for a table from its name, we
    // need to to cast the table ident to regclass then to oid. 'pg_class'
    // is the catalog the table belongs to.
    String identifier = String.format("\'public.%s\'", quote_ident(tableName));
    String query = String.format("SELECT obj_description(%s::regclass::oid, 'pg_class') as comment",
            identifier);/*from w w  w  .ja va 2s .c o  m*/

    String comment = "";
    CachedRowSet result = this.runJDBCQuery(query, null, databaseServer, databaseName);
    if (result == null) {
        return comment;
    }
    try {
        while (result.next()) {
            comment = result.getString("comment");
        }
    } finally {
        result.close();
    }
    return comment;
}