Java Code Examples for java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE

The following are Jave code examples for showing how to use TYPE_SCROLL_INSENSITIVE of the java.sql.ResultSet class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: the-vigilantes   File: DatabaseMetaData.java   View Source Code Vote up 7 votes
/**
 * JDBC 2.0 Does the database support the concurrency type in combination
 * with the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @param concurrency
 *            type defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
    switch (type) {
        case ResultSet.TYPE_SCROLL_INSENSITIVE:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_FORWARD_ONLY:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_SCROLL_SENSITIVE:
            return false;
        default:
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());
    }

}
 
Example 2
Project: BibliotecaPS   File: DatabaseMetaData.java   View Source Code Vote up 6 votes
/**
 * JDBC 2.0 Does the database support the concurrency type in combination
 * with the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @param concurrency
 *            type defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
    switch (type) {
        case ResultSet.TYPE_SCROLL_INSENSITIVE:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_FORWARD_ONLY:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_SCROLL_SENSITIVE:
            return false;
        default:
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());
    }

}
 
Example 3
Project: OpenVertretung   File: DatabaseMetaData.java   View Source Code Vote up 6 votes
/**
 * JDBC 2.0 Does the database support the concurrency type in combination
 * with the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @param concurrency
 *            type defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
    switch (type) {
        case ResultSet.TYPE_SCROLL_INSENSITIVE:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_FORWARD_ONLY:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_SCROLL_SENSITIVE:
            return false;
        default:
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());
    }

}
 
Example 4
Project: lams   File: DatabaseMetaData.java   View Source Code Vote up 6 votes
/**
 * JDBC 2.0 Does the database support the concurrency type in combination
 * with the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @param concurrency
 *            type defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
    switch (type) {
        case ResultSet.TYPE_SCROLL_INSENSITIVE:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_FORWARD_ONLY:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_SCROLL_SENSITIVE:
            return false;
        default:
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());
    }

}
 
Example 5
Project: ProyectoPacientes   File: DatabaseMetaData.java   View Source Code Vote up 6 votes
/**
 * JDBC 2.0 Does the database support the concurrency type in combination
 * with the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @param concurrency
 *            type defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
    switch (type) {
        case ResultSet.TYPE_SCROLL_INSENSITIVE:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_FORWARD_ONLY:
            if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
                return true;
            }
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        case ResultSet.TYPE_SCROLL_SENSITIVE:
            return false;
        default:
            throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());
    }

}
 
Example 6
Project: incubator-netbeans   File: SQLExecutionHelper.java   View Source Code Vote up 5 votes
/**
 * Determine if DBMS/Driver supports scrollable resultsets to be able to
 * determine complete row count for a given SQL.
 *
 * @param conn established JDBC connection
 * @param dc connection information
 * @param sql the sql to be executed
 */
private void updateScrollableSupport(Connection conn, DatabaseConnection dc,
        String sql) {
    useScrollableCursors = dc.isUseScrollableCursors();
    if (!useScrollableCursors) {
        return;
    }
    String driverName = dc.getDriverClass();
    /* Derby fails to support scrollable cursors when invoking 'stored procedures'
     which return resultsets - it fails hard: not throwing a SQLException,
     but terminating the connection - so don't try to use scrollable cursor
     on derby, for "non"-selects */
    if (driverName != null && driverName.startsWith("org.apache.derby")) { //NOI18N
        if (!isSelectStatement(sql)) {
            resultSetScrollType = ResultSet.TYPE_FORWARD_ONLY;
            return;
        }
    }
    /* Try to get a "good" scrollable ResultSet and follow the DBs support */
    try {
        if (conn.getMetaData().supportsResultSetType(
                ResultSet.TYPE_SCROLL_INSENSITIVE)) {
            resultSetScrollType = ResultSet.TYPE_SCROLL_INSENSITIVE;
        } else if (conn.getMetaData().supportsResultSetType(
                ResultSet.TYPE_SCROLL_SENSITIVE)) {
            resultSetScrollType = ResultSet.TYPE_SCROLL_SENSITIVE;
        }
    } catch (Exception ex) {
        LOGGER.log(Level.WARNING, "Exception while querying" //NOI18N
                + " database for scrollable resultset support"); //NOI18N
    }
}
 
Example 7
Project: sstore-soft   File: JDBC4DatabaseMetaData.java   View Source Code Vote up 5 votes
@Override
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
{
    checkClosed();
    if (type == ResultSet.TYPE_SCROLL_INSENSITIVE && concurrency == ResultSet.CONCUR_READ_ONLY)
        return true;
    return false;
}
 
Example 8
Project: sstore-soft   File: JDBC4DatabaseMetaData.java   View Source Code Vote up 5 votes
@Override
public boolean supportsResultSetType(int type) throws SQLException
{
    checkClosed();
    if (type == ResultSet.TYPE_SCROLL_INSENSITIVE)
        return true;
    return false;
}
 
Example 9
Project: sstore-soft   File: JDBC4Connection.java   View Source Code Vote up 5 votes
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
    if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY)
        return prepareCall(sql);
    checkClosed();
    throw SQLError.noSupport();
}
 
Example 10
Project: blanco-sfdc-jdbc-driver   File: AbstractBlancoGenericJdbcDatabaseMetaData.java   View Source Code Vote up 5 votes
public boolean supportsResultSetType(int type) throws SQLException {
	if (type == ResultSet.TYPE_FORWARD_ONLY) {
		return true;
	}
	if (type == ResultSet.TYPE_SCROLL_INSENSITIVE) {
		// TODO あとでよく見る。
		return false;
	}
	if (type == ResultSet.TYPE_SCROLL_SENSITIVE) {
		// TODO あとでよく見る。
		return true;
	}
	return false;
}
 
Example 11
Project: s-store   File: JDBC4Connection.java   View Source Code Vote up 5 votes
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
    if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY)
        return prepareCall(sql);
    checkClosed();
    throw SQLError.noSupport();
}
 
Example 12
Project: s-store   File: JDBC4Connection.java   View Source Code Vote up 5 votes
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
    if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY)
        return prepareStatement(sql);
    checkClosed();
    throw SQLError.noSupport();
}
 
Example 13
Project: openjdk-jdk10   File: CommonRowSetTests.java   View Source Code Vote up 5 votes
@DataProvider(name = "rowSetScrollTypes")
protected Object[][] rowSetScrollTypes() throws Exception {
    RowSet rs = newInstance();

    return new Object[][]{
        {rs, ResultSet.TYPE_FORWARD_ONLY},
        {rs, ResultSet.TYPE_SCROLL_INSENSITIVE},
        {rs, ResultSet.TYPE_SCROLL_SENSITIVE}
    };
}
 
Example 14
Project: jdk8u-jdk   File: CommonRowSetTests.java   View Source Code Vote up 5 votes
@DataProvider(name = "rowSetScrollTypes")
protected Object[][] rowSetScrollTypes() throws Exception {
    RowSet rs = newInstance();

    return new Object[][]{
        {rs, ResultSet.TYPE_FORWARD_ONLY},
        {rs, ResultSet.TYPE_SCROLL_INSENSITIVE},
        {rs, ResultSet.TYPE_SCROLL_SENSITIVE}
    };
}
 
Example 15
Project: sstore-soft   File: JDBC4Statement.java   View Source Code Vote up 4 votes
@Override
public int getResultSetType() throws SQLException
{
    checkClosed();
    return ResultSet.TYPE_SCROLL_INSENSITIVE;
}
 
Example 16
Project: sstore-soft   File: JDBC4Connection.java   View Source Code Vote up 3 votes
/**
 * Check if the createStatement() options are supported
 *
 * See http://docs.oracle.com/javase/7/docs/api/index.html?java/sql/DatabaseMetaData.html
 *
 * The following flags are supported:
 *  - The type must either be TYPE_SCROLL_INSENSITIVE or TYPE_FORWARD_ONLY.
 *  - The concurrency must be CONCUR_READ_ONLY.
 *  - The holdability must be CLOSE_CURSORS_AT_COMMIT.
 *
 * @param resultSetType  JDBC result set type option
 * @param resultSetConcurrency  JDBC result set concurrency option
 * @param resultSetHoldability  JDBC result set holdability option
 * @throws SQLException  if not supported
 */
private static void checkCreateStatementSupported(
        int resultSetType, int resultSetConcurrency, int resultSetHoldability)
                throws SQLException
{
    if (   (   (resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE
            &&  resultSetType != ResultSet.TYPE_FORWARD_ONLY))
        || resultSetConcurrency != ResultSet.CONCUR_READ_ONLY
        || resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
        throw SQLError.noSupport();
    }
}
 
Example 17
Project: ProyectoPacientes   File: DatabaseMetaData.java   View Source Code Vote up 2 votes
/**
 * JDBC 2.0 Does the database support the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetType(int type) throws SQLException {
    return (type == ResultSet.TYPE_SCROLL_INSENSITIVE);
}
 
Example 18
Project: the-vigilantes   File: DatabaseMetaData.java   View Source Code Vote up 2 votes
/**
 * JDBC 2.0 Does the database support the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetType(int type) throws SQLException {
    return (type == ResultSet.TYPE_SCROLL_INSENSITIVE);
}
 
Example 19
Project: BibliotecaPS   File: DatabaseMetaData.java   View Source Code Vote up 2 votes
/**
 * JDBC 2.0 Does the database support the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetType(int type) throws SQLException {
    return (type == ResultSet.TYPE_SCROLL_INSENSITIVE);
}
 
Example 20
Project: OpenVertretung   File: DatabaseMetaData.java   View Source Code Vote up 2 votes
/**
 * JDBC 2.0 Does the database support the given result set type?
 * 
 * @param type
 *            defined in java.sql.ResultSet
 * @return true if so
 * @exception SQLException
 *                if a database-access error occurs.
 * @see Connection
 */
public boolean supportsResultSetType(int type) throws SQLException {
    return (type == ResultSet.TYPE_SCROLL_INSENSITIVE);
}