java.sql.ResultSet#CONCUR_READ_ONLY源码实例Demo

下面列出了java.sql.ResultSet#CONCUR_READ_ONLY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: snowflake-jdbc   文件: SnowflakeConnectionV1.java
public PreparedStatement prepareStatement(String sql, boolean skipParsing)
throws SQLException
{
  logger.debug(
      "PreparedStatement prepareStatement(String sql, boolean skipParsing)");
  raiseSQLExceptionIfConnectionIsClosed();
  PreparedStatement stmt = new SnowflakePreparedStatementV1(
      this,
      sql,
      skipParsing,
      ResultSet.TYPE_FORWARD_ONLY,
      ResultSet.CONCUR_READ_ONLY,
      ResultSet.CLOSE_CURSORS_AT_COMMIT);
  openStatements.add(stmt);
  return stmt;
}
 
CassandraStatement(CassandraConnection con, String cql, int resultSetType, int resultSetConcurrency,
                   int resultSetHoldability) throws SQLException
{
    this.connection = con;
    this.cql = cql;
    this.batchQueries = Lists.newArrayList();
    
    this.consistencyLevel = con.defaultConsistencyLevel;

    if (!(resultSetType == ResultSet.TYPE_FORWARD_ONLY
          || resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE
          || resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE)) throw new SQLSyntaxErrorException(BAD_TYPE_RSET);
    this.resultSetType = resultSetType;

    if (!(resultSetConcurrency == ResultSet.CONCUR_READ_ONLY
          || resultSetConcurrency == ResultSet.CONCUR_UPDATABLE)) throw new SQLSyntaxErrorException(BAD_TYPE_RSET);
    this.resultSetConcurrency = resultSetConcurrency;


    if (!(resultSetHoldability == ResultSet.HOLD_CURSORS_OVER_COMMIT
          || resultSetHoldability == ResultSet.CLOSE_CURSORS_AT_COMMIT))
        throw new SQLSyntaxErrorException(BAD_HOLD_RSET);
    this.resultSetHoldability = resultSetHoldability;
}
 
源代码3 项目: spliceengine   文件: DRDAStatement.java
/**
 * This method resets the state of this DRDAStatement object so that it can
 * be re-used. This method should reset all variables of this class except 
 * the following:
    * 1. database - This variable gets initialized in the constructor and by
    * call to setDatabase.
    * 2. members which get initialized in setPkgnamcsn (pkgnamcsn, pkgcnstkn, 
    * pkgid, pkgsn, isolationLevel, cursorName). pkgnamcsn is the key used to 
    * find if the DRDAStatement can be re-used. Hence its value will not change 
    * when the object is re-used.
 * 
 */
protected void reset() 
{
	setTypDefValues();
	
	withHoldCursor = -1;
	scrollType = ResultSet.TYPE_FORWARD_ONLY;	
	concurType = ResultSet.CONCUR_READ_ONLY;
	rowCount = 0;
	rslsetflg = null;
	maxrslcnt = 0;
	ps = null;
	stmtPmeta = null;
	isCall = false;
	procName = null;
	outputTypes = null;
	outputExpected = false;
	stmt = null;
       truncationWarnings = null;
	
	currentDrdaRs.reset();
	resultSetTable = null;
	resultSetKeyList = null;
	numResultSets = 0;
	
	// Clear parameters without releasing storage
	drdaParamState_.clear(false);
	
	nbrrow = 0;
	qryrowset = 0;	
	blksize = 0;		
	maxblkext = 0;	
	outovropt = 0;	
	qryrfrtbl = false;
	qryprctyp = CodePoint.QRYBLKCTL_DEFAULT;

	needsToSendParamData = false;
	explicitlyPrepared = false;
}
 
源代码4 项目: jdk8u-jdk   文件: CommonRowSetTests.java
@DataProvider(name = "rowSetConcurrencyTypes")
protected Object[][] rowSetConcurrencyTypes() throws Exception {
    RowSet rs = newInstance();
    return new Object[][]{
        {rs, ResultSet.CONCUR_READ_ONLY},
        {rs, ResultSet.CONCUR_UPDATABLE}
    };
}
 
源代码5 项目: snowflake-jdbc   文件: SnowflakeConnectionV1.java
public CallableStatement prepareCall(String sql, boolean skipParsing) throws SQLException
{
  logger.debug(
      " public CallableStatement prepareCall(String sql, boolean skipParsing)");
  raiseSQLExceptionIfConnectionIsClosed();
  CallableStatement stmt = new SnowflakeCallableStatementV1(
      this, sql, skipParsing, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
      ResultSet.CLOSE_CURSORS_AT_COMMIT);
  openStatements.add(stmt);
  return stmt;
}
 
源代码6 项目: barleydb   文件: QueryExecuter.java
private static int getResultSetConcurrency(RuntimeProperties props) throws BarleyDBQueryException {
    if (props == null) {
        return ResultSet.CONCUR_READ_ONLY;
    }
    switch (props.getConcurrency()) {
        case READ_ONLY:
            return ResultSet.CONCUR_READ_ONLY;
        case UPDATABLE:
            return ResultSet.CONCUR_UPDATABLE;
        default:
            throw new IllegalQueryStateException("Unknown concurrency '" + props.getConcurrency() + "'");
    }
}
 
源代码7 项目: phoenix   文件: PhoenixConnection.java
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency)
        throws SQLException {
    checkOpen();
    if (resultSetType != ResultSet.TYPE_FORWARD_ONLY
            || resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) {
        throw new SQLFeatureNotSupportedException();
    }
    return createStatement();
}
 
源代码8 项目: jTDS   文件: CachedResultSet.java
/**
 * Creates a cached result set containing one row.
 *
 * @param statement the parent statement object
 * @param columns   the column descriptor array
 * @param data      the row data
 * @throws SQLException if an error occurs
 */
CachedResultSet(JtdsStatement statement,
        ColInfo columns[], Object data[]) throws SQLException {
    super(statement, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, null);
    this.columns       = columns;
    columnCount   = getColumnCount(columns);
    rowData       = new ArrayList(1);
    rowsInResult  = 1;
    pos           = POS_BEFORE_FIRST;
    tempResultSet = true;
    cursorName    = null;
    rowData.add(copyRow(data));
    procName      = null;
    procedureParams = null;
}
 
源代码9 项目: snowflake-jdbc   文件: SnowflakeStatementV1.java
/**
 * Construct SnowflakeStatementV1
 *
 * @param connection           connection object
 * @param resultSetType        result set type: ResultSet.TYPE_FORWARD_ONLY.
 * @param resultSetConcurrency result set concurrency: ResultSet.CONCUR_READ_ONLY.
 * @param resultSetHoldability result set holdability: ResultSet.CLOSE_CURSORS_AT_COMMIT
 * @throws SQLException if any SQL error occurs.
 */
SnowflakeStatementV1(
    SnowflakeConnectionV1 connection,
    int resultSetType,
    int resultSetConcurrency,
    int resultSetHoldability) throws SQLException
{
  logger.debug(
      " public SnowflakeStatement(SnowflakeConnectionV1 conn)");

  this.connection = connection;

  if (resultSetType != ResultSet.TYPE_FORWARD_ONLY)
  {
    throw new SQLFeatureNotSupportedException(
        String.format("ResultSet type %d is not supported.", resultSetType),
        FEATURE_UNSUPPORTED.getSqlState(),
        FEATURE_UNSUPPORTED.getMessageCode());
  }

  if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY)
  {
    throw new SQLFeatureNotSupportedException(
        String.format("ResultSet concurrency %d is not supported.", resultSetConcurrency),
        FEATURE_UNSUPPORTED.getSqlState(),
        FEATURE_UNSUPPORTED.getMessageCode());
  }

  if (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT)
  {
    throw new SQLFeatureNotSupportedException(
        String.format("ResultSet holdability %d is not supported.", resultSetHoldability),
        FEATURE_UNSUPPORTED.getSqlState(),
        FEATURE_UNSUPPORTED.getMessageCode());
  }

  this.resultSetType = resultSetType;
  this.resultSetConcurrency = resultSetConcurrency;
  this.resultSetHoldability = resultSetHoldability;

  sfStatement = (connection != null) ?
                new SFStatement(connection.getSfSession()) : null;
}
 
源代码10 项目: calcite-avatica   文件: AvaticaDatabaseMetaData.java
public boolean supportsResultSetConcurrency(
    int type, int concurrency) throws SQLException {
  return type == ResultSet.TYPE_FORWARD_ONLY
      && concurrency == ResultSet.CONCUR_READ_ONLY;
}
 
源代码11 项目: phoenix   文件: PhoenixStatement.java
@Override
public int getResultSetConcurrency() throws SQLException {
    return ResultSet.CONCUR_READ_ONLY;
}
 
源代码12 项目: jTDS   文件: CachedResultSet.java
/**
 * Creates a cached result set with the same columns (and optionally data)
 * as an existing result set.
 *
 * @param rs   the result set to copy
 * @param load load data from the supplied result set
 * @throws SQLException if an error occurs
 */
CachedResultSet(JtdsResultSet rs, boolean load) throws SQLException {
    super((JtdsStatement)rs.getStatement(),
            rs.getStatement().getResultSetType(),
            rs.getStatement().getResultSetConcurrency(), null);
    //
    JtdsStatement stmt = ((JtdsStatement) rs.getStatement());
    //
    // OK If the user requested an updateable result set tell them
    // they can't have one!
    //
    if (concurrency != ResultSet.CONCUR_READ_ONLY) {
        concurrency = ResultSet.CONCUR_READ_ONLY;
        stmt.addWarning(new SQLWarning(
            Messages.get("warning.cursordowngraded",
                         "CONCUR_READ_ONLY"), "01000"));
    }
    //
    // If the user requested a scroll sensitive cursor tell them
    // they can't have that either!
    //
    if (resultSetType >= ResultSet.TYPE_SCROLL_SENSITIVE) {
        resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
        stmt.addWarning(new SQLWarning(
            Messages.get("warning.cursordowngraded",
                         "TYPE_SCROLL_INSENSITIVE"), "01000"));
    }

    columns       = rs.getColumns();
    columnCount   = getColumnCount(columns);
    rowData       = new ArrayList(INITIAL_ROW_COUNT);
    rowsInResult  = 0;
    pos           = POS_BEFORE_FIRST;
    tempResultSet = true;
    cursorName    = null;
    procName      = null;
    procedureParams = null;
    //
    // Load result set into buffer
    //
    if (load) {
        while (rs.next()) {
            rowData.add(copyRow(rs.getCurrentRow()));
        }
        rowsInResult  = rowData.size();
    }
}
 
源代码13 项目: tddl5   文件: TResultSet.java
@Override
public int getConcurrency() throws SQLException {
    return ResultSet.CONCUR_READ_ONLY;
}
 
CassandraStatement(CassandraConnection con) throws SQLException
{
    this(con, null, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
}
 
源代码15 项目: phoenix   文件: PhoenixResultSet.java
@Override
public int getConcurrency() throws SQLException {
    return ResultSet.CONCUR_READ_ONLY;
}
 
public int getResultSetConcurrency() throws SQLException
{
    checkNotClosed();
    return ResultSet.CONCUR_READ_ONLY;
}
 
@Override
public int getResultSetConcurrency() throws SQLException {
  return ResultSet.CONCUR_READ_ONLY;
}
 
源代码18 项目: gemfirexd-oss   文件: DRDAStatement.java
/**
	 * This method resets the state of this DRDAStatement object so that it can
	 * be re-used. This method should reset all variables of this class except 
	 * the following:
     * 1. database - This variable gets initialized in the constructor and by
     * call to setDatabase.
     * 2. members which get initialized in setPkgnamcsn (pkgnamcsn, pkgcnstkn, 
     * pkgid, pkgsn, isolationLevel, cursorName). pkgnamcsn is the key used to 
     * find if the DRDAStatement can be re-used. Hence its value will not change 
     * when the object is re-used.
	 * 
	 */
	protected void reset() 
	{
		setTypDefValues();
		
		withHoldCursor = -1;
		scrollType = ResultSet.TYPE_FORWARD_ONLY;	
		concurType = ResultSet.CONCUR_READ_ONLY;;
		rowCount = 0;
		rslsetflg = null;
		maxrslcnt = 0;
		ps = null;
		stmtPmeta = null;
		isCall = false;
		procName = null;
		outputTypes = null;
		outputExpected = false;
		stmt = null;
// GemStone changes BEGIN
		pstmt = null;
		sqlText = null;
		sqldaType = 0;
		pstmtParseWriterMark = 0;
		resetBatch();
		executionBeginTime = 0;
		statementAccessFrequency = 0;
// GemStone changes END
		
		currentDrdaRs.reset();
		resultSetTable = null;
		resultSetKeyList = null;
		numResultSets = 0;
		
		// Clear parameters without releasing storage
		drdaParamState_.clear(false);
		
		nbrrow = 0;
		qryrowset = 0;	
		blksize = 0;		
		maxblkext = 0;	
		outovropt = 0;	
		qryrfrtbl = false;
		qryprctyp = CodePoint.QRYBLKCTL_DEFAULT;

		needsToSendParamData = false;
		explicitlyPrepared = false;
	}
 
源代码19 项目: gemfirexd-oss   文件: StatementKeyFactory.java
/**
 * Creates a key for a query specifying whether auto-generated keys
 * shall be returned.
 * <p>
 * Unspecified settings will be according to the JDBC standard; result set
 * type will be <code>ResultSet.TYPE_FORWARD_ONLY</code>, concurrency will
 * be <code>ResultSet.CONCUR_READ_ONLY</code>.
 *
 * @param sql SQL query string
 * @param schema current compilation schema
 * @param holdability result set holdability
 * @param autogeneratedKeys tells whether or not to reutrn auto-generated
 *      keys
 * @return A statement key.
 */
public static StatementKey newPrepared(
        String sql, String schema, int holdability, int autogeneratedKeys) {
    return new StatementKey(PREPARED, sql, schema,
                            ResultSet.TYPE_FORWARD_ONLY,
                            ResultSet.CONCUR_READ_ONLY,
                            holdability, autogeneratedKeys);
}
 
源代码20 项目: gemfirexd-oss   文件: StatementKeyFactory.java
/**
 * Creates a key for a query with default settings.
 * <p>
 * Defaults are according to the JDBC standard; result set type will be
 * <code>ResultSet.TYPE_FORWARD_ONLY</code>, concurrency will be
 * <code>ResultSet.CONCUR_READ_ONLY</code> and the statement will not
 * return auto-generated keys.
 *
 * @param sql SQL query string
 * @param schema current compilation schema
 * @param holdability result set holdability
 * @return A statement key.
 */
public static StatementKey newPrepared(
        String sql, String schema, int holdability) {
    return new StatementKey(PREPARED, sql, schema,
            ResultSet.TYPE_FORWARD_ONLY,
            ResultSet.CONCUR_READ_ONLY,
            holdability, Statement.NO_GENERATED_KEYS);
}