Example usage for java.sql Statement CLOSE_ALL_RESULTS

List of usage examples for java.sql Statement CLOSE_ALL_RESULTS

Introduction

In this page you can find the example usage for java.sql Statement CLOSE_ALL_RESULTS.

Prototype

int CLOSE_ALL_RESULTS

To view the source code for java.sql Statement CLOSE_ALL_RESULTS.

Click Source Link

Document

The constant indicating that all ResultSet objects that have previously been kept open should be closed when calling getMoreResults.

Usage

From source file:com.alibaba.wasp.jdbc.JdbcStatement.java

/**
 * Move to the next result set. This method always returns false.
 * // w  w  w  .ja va2  s. c  o  m
 * @param current
 *          Statement.CLOSE_CURRENT_RESULT, Statement.KEEP_CURRENT_RESULT, or
 *          Statement.CLOSE_ALL_RESULTS
 * @return false
 */
@Override
public boolean getMoreResults(int current) throws SQLException {
    try {
        switch (current) {
        case Statement.CLOSE_CURRENT_RESULT:
        case Statement.CLOSE_ALL_RESULTS:
            checkClosed();
            closeOldResultSet();
            break;
        case Statement.KEEP_CURRENT_RESULT:
            // nothing to do
            break;
        default:
            throw JdbcException.getInvalidValueException("current", current);
        }
        return false;
    } catch (Exception e) {
        throw Logger.logAndConvert(log, e);
    }
}

From source file:net.starschema.clouddb.jdbc.BQStatementRoot.java

/**
 * <p>/*from   w  w w  . j  av a 2  s . c o  m*/
 * <h1>Implementation Details:</h1><br>
 * Multiple result sets are not supported currently. we check that the
 * result set is open, the parameter is acceptable, and close our current
 * resultset or throw a FeatureNotSupportedException
 * </p>
 * 
 * @param current
 *            - one of the following Statement constants indicating what
 *            should happen to current ResultSet objects obtained using the
 *            method getResultSet: Statement.CLOSE_CURRENT_RESULT,
 *            Statement.KEEP_CURRENT_RESULT, or Statement.CLOSE_ALL_RESULTS
 * @throws BQSQLException
 */

public boolean getMoreResults(int current) throws SQLException {
    if (this.closed) {
        throw new BQSQLException("Statement is closed.");
    }
    if (current == Statement.CLOSE_CURRENT_RESULT || current == Statement.KEEP_CURRENT_RESULT
            || current == Statement.CLOSE_ALL_RESULTS) {

        if (BQDatabaseMetadata.multipleOpenResultsSupported
                && (current == Statement.KEEP_CURRENT_RESULT || current == Statement.CLOSE_ALL_RESULTS)) {
            throw new BQSQLFeatureNotSupportedException();
        }
        // Statement.CLOSE_CURRENT_RESULT
        this.close();
        return false;
    } else {
        throw new BQSQLException("Wrong parameter.");
    }
}