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

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

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;
}
 
源代码2 项目: gemfirexd-oss   文件: GFXDServiceImpl.java
/**
 * Returns the resultType if set if not set returns the default
 * java.sql.ResultSet.TYPE_FORWARD_ONLY
 */
static int getResultType(StatementAttrs attrs) {
  int rsType;
  if (attrs != null && attrs.isSetResultSetType()) {
    rsType = attrs.getResultSetType();
  }
  else {
    rsType = gfxdConstants.DEFAULT_RESULTSET_TYPE;
  }
  switch (rsType) {
    case gfxdConstants.RESULTSET_TYPE_FORWARD_ONLY:
      return ResultSet.TYPE_FORWARD_ONLY;
    case gfxdConstants.RESULTSET_TYPE_INSENSITIVE:
      return ResultSet.TYPE_SCROLL_INSENSITIVE;
    case gfxdConstants.RESULTSET_TYPE_SENSITIVE:
      return ResultSet.TYPE_SCROLL_SENSITIVE;
    default:
      throw new InternalGemFireError("unknown resultSet type "
          + attrs.getResultSetType());
  }
}
 
public int getBestResultSetType( final DataRow dataRow ) throws SQLException {
  if ( globalConfig != null && "simple".equalsIgnoreCase( globalConfig.getConfigProperty( //$NON-NLS-1$
          ResultSetTableModelFactory.RESULTSET_FACTORY_MODE ) ) ) { //$NON-NLS-1$
    return ResultSet.TYPE_FORWARD_ONLY;
  }

  final Connection connection = getConnection( dataRow );
  final boolean supportsScrollInsensitive =
      connection.getMetaData().supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
  final boolean supportsScrollSensitive =
      connection.getMetaData().supportsResultSetType( ResultSet.TYPE_SCROLL_SENSITIVE );

  if ( supportsScrollInsensitive ) {
    return ResultSet.TYPE_SCROLL_INSENSITIVE;
  }
  if ( supportsScrollSensitive ) {
    return ResultSet.TYPE_SCROLL_SENSITIVE;
  }
  return ResultSet.TYPE_FORWARD_ONLY;
}
 
源代码4 项目: gemfirexd-oss   文件: GFXDServiceImpl.java
/**
 * Returns the resultType if set if not set returns the default
 * java.sql.ResultSet.TYPE_FORWARD_ONLY
 */
static int getResultType(StatementAttrs attrs) {
  int rsType;
  if (attrs != null && attrs.isSetResultSetType()) {
    rsType = attrs.getResultSetType();
  }
  else {
    rsType = gfxdConstants.DEFAULT_RESULTSET_TYPE;
  }
  switch (rsType) {
    case gfxdConstants.RESULTSET_TYPE_FORWARD_ONLY:
      return ResultSet.TYPE_FORWARD_ONLY;
    case gfxdConstants.RESULTSET_TYPE_INSENSITIVE:
      return ResultSet.TYPE_SCROLL_INSENSITIVE;
    case gfxdConstants.RESULTSET_TYPE_SENSITIVE:
      return ResultSet.TYPE_SCROLL_SENSITIVE;
    default:
      throw new InternalGemFireError("unknown resultSet type "
          + attrs.getResultSetType());
  }
}
 
源代码5 项目: dragonwell8_jdk   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码6 项目: TencentKona-8   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码7 项目: spliceengine   文件: EmbedConnection.java
private int setResultSetType(int resultSetType) {

		/* Add warning if scroll sensitive cursor
		 * and downgrade to scroll insensitive cursor.
		 */
		if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE)
		{
			addWarning(SQLWarningFactory.newSQLWarning(SQLState.NO_SCROLL_SENSITIVE_CURSORS));
			resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
		}
		return resultSetType;
	}
 
源代码8 项目: openjdk-jdk8u   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码9 项目: netbeans   文件: SQLExecutionHelper.java
/**
 * 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
    }
}
 
源代码10 项目: gemfirexd-oss   文件: EmbedDatabaseMetaData.java
/**
    * JDBC 2.0
    *
    * Determine whether or not a visible row update can be detected by 
    * calling ResultSet.rowUpdated().
    *
    * @param type result set type, i.e. ResultSet.TYPE_XXX
    * @return true if updates are detected by the resultset type
    */
   public boolean updatesAreDetected(int type) {
	if (type == ResultSet.TYPE_SCROLL_INSENSITIVE) {
		return true;
	} else {
		// For forward only resultsets, we move to before the next
		// row after a update and that is why updatesAreDetected
		// returns false.
		return false;
	}
}
 
源代码11 项目: hottub   文件: CommonRowSetTests.java
@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}
    };
}
 
源代码12 项目: gemfirexd-oss   文件: Converters.java
public static int getThriftResultSetType(int jdbcType) {
  switch (jdbcType) {
    case ResultSet.TYPE_FORWARD_ONLY:
      return gfxdConstants.RESULTSET_TYPE_FORWARD_ONLY;
    case ResultSet.TYPE_SCROLL_INSENSITIVE:
      return gfxdConstants.RESULTSET_TYPE_INSENSITIVE;
    case ResultSet.TYPE_SCROLL_SENSITIVE:
      return gfxdConstants.RESULTSET_TYPE_SENSITIVE;
    default:
      return gfxdConstants.RESULTSET_TYPE_UNKNOWN;
  }
}
 
源代码13 项目: barleydb   文件: QueryExecuter.java
private static int getResultSetType(RuntimeProperties props) throws BarleyDBQueryException {
    if (props.getScrollType() == null) {
        return ResultSet.TYPE_FORWARD_ONLY;
    }
    switch(props.getScrollType()) {
        case FORWARD_ONLY:
            return ResultSet.TYPE_FORWARD_ONLY;
        case SCROLL_INSENSITIVE:
            return ResultSet.TYPE_SCROLL_INSENSITIVE;
        case SCROLL_SENSITIVE:
            return ResultSet.TYPE_SCROLL_SENSITIVE;
        default:
            throw new IllegalQueryStateException("Unknown scroll type '" + props.getScrollType() + "'");
    }
}
 
源代码14 项目: gemfirexd-oss   文件: EmbedDatabaseMetaData.java
/**
    * JDBC 2.0
    *
    * Determine whether or not a visible row update can be detected by 
    * calling ResultSet.rowUpdated().
    *
    * @param type result set type, i.e. ResultSet.TYPE_XXX
    * @return true if updates are detected by the resultset type
    */
   public boolean updatesAreDetected(int type) {
	if (type == ResultSet.TYPE_SCROLL_INSENSITIVE) {
		return true;
	} else {
		// For forward only resultsets, we move to before the next
		// row after a update and that is why updatesAreDetected
		// returns false.
		return false;
	}
}
 
源代码15 项目: gemfirexd-oss   文件: EmbedConnection.java
private int setResultSetType(int resultSetType) {
	/* Add warning if scroll sensitive cursor
	 * and downgrade to scroll insensitive cursor.
	 */
	if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE)
	{
		addWarning(SQLWarningFactory.newSQLWarning(SQLState.NO_SCROLL_SENSITIVE_CURSORS));
		resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
	}
	return resultSetType;
}
 
源代码16 项目: sql4es   文件: ESResultSet.java
@Override
public int getType() throws SQLException {
	return ResultSet.TYPE_SCROLL_INSENSITIVE;
}
 
源代码17 项目: gemfirexd-oss   文件: EmbedDatabaseMetaData.java
/**
    * JDBC 2.0
    *
    * Determine whether a result set's updates are visible.
    *
    * @param type result set type, i.e. ResultSet.TYPE_XXX
    * @return true if updates are visible for the result set type
    */
   public boolean ownUpdatesAreVisible(int type)   {
		if (type == ResultSet.TYPE_SCROLL_INSENSITIVE) {
			return true;
		} else {
			return false;
		}
}
 
源代码18 项目: gemfirexd-oss   文件: EmbedDatabaseMetaData.java
/**
    * JDBC 2.0
    *
    * Does the database support the given result set type?
    *
    * @param type defined in java.sql.ResultSet
    * @return true if so 
    * @see Connection
    */
public boolean supportsResultSetType(int type) {
	if ((type == ResultSet.TYPE_FORWARD_ONLY) ||
	    (type == ResultSet.TYPE_SCROLL_INSENSITIVE)) {
		return true;
	}
   //we don't support TYPE_SCROLL_SENSITIVE yet.
   return false;
}
 
源代码19 项目: gemfirexd-oss   文件: EmbedDatabaseMetaData.java
/**
    * JDBC 2.0
    *
    * Does the database support the given result set type?
    *
    * @param type defined in java.sql.ResultSet
    * @return true if so 
    * @see Connection
    */
public boolean supportsResultSetType(int type) {
	if ((type == ResultSet.TYPE_FORWARD_ONLY) ||
	    (type == ResultSet.TYPE_SCROLL_INSENSITIVE)) {
		return true;
	}
   //we don't support TYPE_SCROLL_SENSITIVE yet.
   return false;
}
 
源代码20 项目: openbd-core   文件: cfQueryResultData.java
/**
 * Retrieves the type of this <code>ResultSet</code> object.  
 * The type is determined by the <code>Statement</code> object
 * that created the result set.
 *
 * @return <code>ResultSet.TYPE_FORWARD_ONLY</code>,
 *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>,
 *         or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
 * @exception SQLException if a database access error occurs
 * @since 1.2
 */
public int getType() throws SQLException {
	return ResultSet.TYPE_SCROLL_INSENSITIVE;
}