Java Code Examples for java.sql.ResultSet#CLOSE_CURSORS_AT_COMMIT

The following examples show how to use java.sql.ResultSet#CLOSE_CURSORS_AT_COMMIT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SnowflakeConnectionV1.java    From snowflake-jdbc with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: ClientDBMetaData.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean supportsResultSetHoldability(int holdability)
    throws SQLException {
  this.conn.lock();
  try {
    initServiceMetaData();
    Set<ServiceFeature> supportedFeatures = this.serviceMetaData
        .getSupportedFeatures();
    switch (holdability) {
      case ResultSet.CLOSE_CURSORS_AT_COMMIT:
        return supportedFeatures.contains(
            ServiceFeature.RESULTSET_HOLDABILITY_CLOSE_CURSORS_AT_COMMIT);
      case ResultSet.HOLD_CURSORS_OVER_COMMIT:
        return supportedFeatures.contains(
            ServiceFeature.RESULTSET_HOLDABILITY_HOLD_CURSORS_OVER_COMMIT);
      default:
        return false;
    }
  } finally {
    this.conn.unlock();
  }
}
 
Example 3
Source File: SnowflakeDatabaseMetaData.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean supportsResultSetHoldability(int holdability)
throws SQLException
{
  logger.debug(
      "public boolean supportsResultSetHoldability(int holdability)");
  raiseSQLExceptionIfConnectionIsClosed();
  return holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 4
Source File: PhoenixConnection.java    From phoenix with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
        int resultSetHoldability) throws SQLException {
    if (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
        throw new SQLFeatureNotSupportedException();
    }
    return prepareStatement(sql, resultSetType, resultSetConcurrency);
}
 
Example 5
Source File: PhoenixConnection.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
        int resultSetHoldability) throws SQLException {
    if (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
        throw new SQLFeatureNotSupportedException();
    }
    return prepareStatement(sql, resultSetType, resultSetConcurrency);
}
 
Example 6
Source File: ResultSetTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Convert holdability from an integer to a readable string.
 *
 * @param holdability an <code>int</code> value representing a holdability
 * @return a <code>String</code> value representing the same holdability
 *
 */
private static String holdabilityString(int holdability) {
    switch (holdability) {
    case ResultSet.HOLD_CURSORS_OVER_COMMIT:
        return "HOLD_CURSORS_OVER_COMMIT";
    case ResultSet.CLOSE_CURSORS_AT_COMMIT:
        return "CLOSE_CURSORS_AT_COMMIT";
    default:
        return "UNKNOWN HOLDABILITY";
    }
}
 
Example 7
Source File: EmbedXAConnection.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
	Are held cursors allowed. If the connection is attached to
       a global transaction then downgrade the result set holdabilty
       to CLOSE_CURSORS_AT_COMMIT if downgrade is true, otherwise
       throw an exception.
       If the connection is in a local transaction then the
       passed in holdabilty is returned.
*/
public int  checkHoldCursors(int holdability, boolean downgrade)
       throws SQLException
   {
	if (holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT) {		
		if (isGlobal()) {
               if (!downgrade)
                   throw Util.generateCsSQLException(SQLState.CANNOT_HOLD_CURSOR_XA);
               
               holdability = ResultSet.CLOSE_CURSORS_AT_COMMIT;
           }
	}

	return super.checkHoldCursors(holdability, downgrade);
}
 
Example 8
Source File: ClickHouseConnectionImpl.java    From clickhouse-jdbc with Apache License 2.0 5 votes vote down vote up
@Override
public ClickHouseStatement createStatement(int resultSetType, int resultSetConcurrency,
                                           int resultSetHoldability) throws SQLException {
    if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE || resultSetConcurrency != ResultSet.CONCUR_READ_ONLY
        || resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
        throw new SQLFeatureNotSupportedException();
    }
    return createStatement(resultSetType);
}
 
Example 9
Source File: ClientDBMetaData.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int getResultSetHoldability() throws SQLException {
  this.conn.lock();
  try {
    initServiceMetaData();
    return this.serviceMetaData
        .isDefaultResultSetHoldabilityHoldCursorsOverCommit() ? ResultSet.HOLD_CURSORS_OVER_COMMIT
        : ResultSet.CLOSE_CURSORS_AT_COMMIT;
  } finally {
    this.conn.unlock();
  }
}
 
Example 10
Source File: SnowflakeConnectionV1.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 11
Source File: PhoenixStatement.java    From phoenix with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public int getResultSetHoldability() throws SQLException {
    // TODO: not sure this matters
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 12
Source File: AbstractConnectionAdapter.java    From sharding-jdbc-1.5.1 with Apache License 2.0 4 votes vote down vote up
@Override
public final int getHoldability() throws SQLException {
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 13
Source File: TConnection.java    From tddl5 with Apache License 2.0 4 votes vote down vote up
@Override
public int getHoldability() throws SQLException {
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 14
Source File: SnowflakeDatabaseMetaData.java    From snowflake-jdbc with Apache License 2.0 4 votes vote down vote up
@Override
public int getResultSetHoldability() throws SQLException
{
  logger.debug("public int getResultSetHoldability()");
  return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 15
Source File: Ideas_2013_01_29.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
int foobar() {
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 16
Source File: HerdDBDatabaseMetadata.java    From herddb with Apache License 2.0 4 votes vote down vote up
@Override
public int getResultSetHoldability() throws SQLException {
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 17
Source File: JDBCDatabaseMetaData.java    From sql-layer with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public boolean supportsResultSetHoldability(int holdability) throws SQLException {
    return (holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT);
}
 
Example 18
Source File: PhoenixConnection.java    From phoenix with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public int getHoldability() throws SQLException {
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 19
Source File: TConnection.java    From tddl with Apache License 2.0 4 votes vote down vote up
@Override
public int getHoldability() throws SQLException {
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
 
Example 20
Source File: TGroupConnection.java    From tddl with Apache License 2.0 4 votes vote down vote up
public int getHoldability() throws SQLException {
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}