下面列出了java.sql.ResultSet#CLOSE_CURSORS_AT_COMMIT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
/**
* {@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();
}
}
@Override
public boolean supportsResultSetHoldability(int holdability)
throws SQLException
{
logger.debug(
"public boolean supportsResultSetHoldability(int holdability)");
raiseSQLExceptionIfConnectionIsClosed();
return holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
@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);
}
/**
* 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";
}
}
/**
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);
}
@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);
}
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;
}
/**
* {@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();
}
}
@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);
}
@Override
public final int getHoldability() throws SQLException {
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
public int getHoldability() throws SQLException {
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
@Override
public int getHoldability() throws SQLException {
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
@Override
public int getHoldability() throws SQLException {
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
@Override
public boolean supportsResultSetHoldability(int holdability) throws SQLException {
return (holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT);
}
@Override
public int getResultSetHoldability() throws SQLException {
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
int foobar() {
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
@Override
public int getResultSetHoldability() throws SQLException
{
logger.debug("public int getResultSetHoldability()");
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
@Override
public int getHoldability() throws SQLException {
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}
@Override
public int getResultSetHoldability() throws SQLException {
// TODO: not sure this matters
return ResultSet.CLOSE_CURSORS_AT_COMMIT;
}