当前位置: 首页>>代码示例>>Java>>正文


Java ResultSet.CONCUR_READ_ONLY属性代码示例

本文整理汇总了Java中java.sql.ResultSet.CONCUR_READ_ONLY属性的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.CONCUR_READ_ONLY属性的具体用法?Java ResultSet.CONCUR_READ_ONLY怎么用?Java ResultSet.CONCUR_READ_ONLY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.sql.ResultSet的用法示例。


在下文中一共展示了ResultSet.CONCUR_READ_ONLY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: supportsResultSetConcurrency

/**
 * 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());
    }

}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:37,代码来源:DatabaseMetaData.java

示例2: checkCursor

protected void checkCursor(int rst, int rsc, int rsh) throws SQLException {
    if (rst != ResultSet.TYPE_FORWARD_ONLY)
        throw new SQLException("SQLite only supports TYPE_FORWARD_ONLY cursors");
    if (rsc != ResultSet.CONCUR_READ_ONLY)
        throw new SQLException("SQLite only supports CONCUR_READ_ONLY cursors");
    if (rsh != ResultSet.CLOSE_CURSORS_AT_COMMIT)
        throw new SQLException("SQLite only supports closing cursors at commit");
}
 
开发者ID:Morgan-Stanley,项目名称:Saturn,代码行数:8,代码来源:SyncConn.java

示例3: rowSetConcurrencyTypes

@DataProvider(name = "rowSetConcurrencyTypes")
protected Object[][] rowSetConcurrencyTypes() throws Exception {
    RowSet rs = newInstance();
    return new Object[][]{
        {rs, ResultSet.CONCUR_READ_ONLY},
        {rs, ResultSet.CONCUR_UPDATABLE}
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:CommonRowSetTests.java

示例4: prepareCall

@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();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:8,代码来源:JDBC4Connection.java

示例5: createStatement

@Override
   public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) {
    throw new SQLException(
	    String.format("Statement with resultset concurrency %d is not supported", resultSetConcurrency));
}
if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) {
    throw new SQLException(String.format("Statement with resultset type %d is not supported", resultSetType));
}
return new TsfileStatement(this, client, sessionHandle);
   }
 
开发者ID:thulab,项目名称:iotdb-jdbc,代码行数:11,代码来源:TsfileConnection.java

示例6: checkUpdatable

private void checkUpdatable() throws SQLException {

        checkClosed();

        if (rsConcurrency == ResultSet.CONCUR_READ_ONLY) {
            throw Util.notUpdatableColumn();
        }
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:8,代码来源:JDBCResultSet.java

示例7: isCursorRequired

@Override
boolean isCursorRequired() throws SQLException {
    // we only create cursor-backed result sets if
    // a) The query is a SELECT
    // b) The server supports it
    // c) We know it is forward-only (note this doesn't preclude updatable result sets)
    // d) The user has set a fetch size
    return this.resultFields != null && this.connection.isCursorFetchEnabled() && getResultSetType() == ResultSet.TYPE_FORWARD_ONLY
            && getResultSetConcurrency() == ResultSet.CONCUR_READ_ONLY && getFetchSize() > 0;
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:10,代码来源:ServerPreparedStatement.java

示例8: supportsResultSetConcurrency

@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;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:8,代码来源:JDBC4DatabaseMetaData.java

示例9: prepareStatement

@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();
}
 
开发者ID:s-store,项目名称:s-store,代码行数:8,代码来源:JDBC4Connection.java

示例10: getResultSetConcurrency

@Override
default int getResultSetConcurrency() throws SQLException {
    return ResultSet.CONCUR_READ_ONLY;
}
 
开发者ID:agroal,项目名称:agroal,代码行数:4,代码来源:MockStatement.java

示例11: supportsResultSetConcurrency

@Override
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
{
	return type == ResultSet.TYPE_FORWARD_ONLY && concurrency == ResultSet.CONCUR_READ_ONLY;
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:5,代码来源:CloudSpannerDatabaseMetaData.java

示例12: getConcurrency

@Override
public int getConcurrency() throws SQLException {
	return ResultSet.CONCUR_READ_ONLY;
}
 
开发者ID:thulab,项目名称:iotdb-jdbc,代码行数:4,代码来源:TsfileQueryResultSet.java

示例13: getResultSetConcurrency

@Override
public int getResultSetConcurrency() throws SQLException
{
    checkClosed();
    return ResultSet.CONCUR_READ_ONLY;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:6,代码来源:JDBC4Statement.java

示例14: useServerFetch

private boolean useServerFetch() throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        return this.connection.isCursorFetchEnabled() && this.fetchSize > 0 && this.resultSetConcurrency == ResultSet.CONCUR_READ_ONLY
                && this.resultSetType == ResultSet.TYPE_FORWARD_ONLY;
    }
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:6,代码来源:StatementImpl.java

示例15: checkCreateStatementSupported

/**
 * 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();
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:26,代码来源:JDBC4Connection.java


注:本文中的java.sql.ResultSet.CONCUR_READ_ONLY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。