Java Code Examples for java.sql.Statement#CLOSE_CURRENT_RESULT
The following examples show how to use
java.sql.Statement#CLOSE_CURRENT_RESULT .
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: StatementWrapper.java From lams with GNU General Public License v2.0 | 5 votes |
public int getResultSetHoldability() throws SQLException { try { if (this.wrappedStmt != null) { return this.wrappedStmt.getResultSetHoldability(); } throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } return Statement.CLOSE_CURRENT_RESULT; }
Example 2
Source File: ConnectionWrapper.java From lams with GNU General Public License v2.0 | 5 votes |
public int getHoldability() throws SQLException { try { return this.mc.getHoldability(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return Statement.CLOSE_CURRENT_RESULT; // we don't reach this code, compiler can't tell }
Example 3
Source File: StatementWrapper.java From r-course with MIT License | 5 votes |
public int getResultSetHoldability() throws SQLException { try { if (this.wrappedStmt != null) { return this.wrappedStmt.getResultSetHoldability(); } throw SQLError.createSQLException("Statement already closed", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } return Statement.CLOSE_CURRENT_RESULT; }
Example 4
Source File: ConnectionWrapper.java From r-course with MIT License | 5 votes |
/** * @see Connection#getHoldability() */ public int getHoldability() throws SQLException { checkClosed(); try { return this.mc.getHoldability(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return Statement.CLOSE_CURRENT_RESULT; // we don't reach this code, // compiler can't tell }
Example 5
Source File: StatementWrapper.java From Komondor with GNU General Public License v3.0 | 5 votes |
public int getResultSetHoldability() throws SQLException { try { if (this.wrappedStmt != null) { return this.wrappedStmt.getResultSetHoldability(); } throw SQLError.createSQLException("Statement already closed", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } return Statement.CLOSE_CURRENT_RESULT; }
Example 6
Source File: ConnectionWrapper.java From Komondor with GNU General Public License v3.0 | 5 votes |
/** * @see Connection#getHoldability() */ public int getHoldability() throws SQLException { checkClosed(); try { return this.mc.getHoldability(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return Statement.CLOSE_CURRENT_RESULT; // we don't reach this code, // compiler can't tell }
Example 7
Source File: SFStatement.java From snowflake-jdbc with Apache License 2.0 | 5 votes |
/** * Sets the result set to the next one, if available. * * @param current What to do with the current result. * One of Statement.CLOSE_CURRENT_RESULT, * Statement.CLOSE_ALL_RESULTS, or * Statement.KEEP_CURRENT_RESULT * @return true if there is a next result and it's a result set * false if there are no more results, or there is a next result * and it's an update count * @throws SQLException if something fails while getting the next result */ public boolean getMoreResults(int current) throws SQLException { // clean up current result, if exists if (resultSet != null && (current == Statement.CLOSE_CURRENT_RESULT || current == Statement.CLOSE_ALL_RESULTS)) { resultSet.close(); } resultSet = null; // verify if more results exist if (childResults == null || childResults.isEmpty()) { return false; } // fetch next result using the query id SFChildResult nextResult = childResults.remove(0); try { JsonNode result = StmtUtil.getQueryResultJSON( nextResult.getId(), session); Object sortProperty = session.getSFSessionProperty("sort"); boolean sortResult = sortProperty != null && (Boolean) sortProperty; resultSet = SFResultSetFactory.getResultSet(result, this, sortResult); // override statement type so we can treat the result set like a result of // the original statement called (and not the result scan) resultSet.setStatementType(nextResult.getType()); return nextResult.getType().isGenerateResultSet(); } catch (SFException ex) { throw new SnowflakeSQLException(ex); } }
Example 8
Source File: StatementWrapper.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public int getResultSetHoldability() throws SQLException { try { if (this.wrappedStmt != null) { return this.wrappedStmt.getResultSetHoldability(); } throw SQLError.createSQLException(Messages.getString("Statement.AlreadyClosed"), MysqlErrorNumbers.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor); } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } return Statement.CLOSE_CURRENT_RESULT; }
Example 9
Source File: ConnectionWrapper.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
@Override public int getHoldability() throws SQLException { try { return this.mc.getHoldability(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return Statement.CLOSE_CURRENT_RESULT; // we don't reach this code, compiler can't tell }
Example 10
Source File: StatementInvocationHandler.java From vibur-dbcp with Apache License 2.0 | 5 votes |
private Object processMoreResults(Method method, Object[] args) throws SQLException { int current = Statement.CLOSE_ALL_RESULTS; if (args != null && args.length == 1) { current = (Integer) args[0]; } if (current == Statement.CLOSE_CURRENT_RESULT) { quietClose(currentResultSets.pollLast()); } else if (current == Statement.CLOSE_ALL_RESULTS) { closeAllResultSets(); } return targetInvoke(method, args); }
Example 11
Source File: SnowflakeStatementV1.java From snowflake-jdbc with Apache License 2.0 | 4 votes |
@Override public boolean getMoreResults(int current) throws SQLException { logger.debug("getMoreResults(int current)"); raiseSQLExceptionIfStatementIsClosed(); // clean up the current result set, if it exists if (resultSet != null && (current == Statement.CLOSE_CURRENT_RESULT || current == Statement.CLOSE_ALL_RESULTS)) { resultSet.close(); } boolean hasResultSet = sfStatement.getMoreResults(current); SFBaseResultSet sfResultSet = sfStatement.getResultSet(); if (hasResultSet) // result set returned { sfResultSet.setSession(this.connection.getSfSession()); if (resultSet != null) { openResultSets.add(resultSet); } resultSet = new SnowflakeResultSetV1(sfResultSet, this); updateCount = NO_UPDATES; return true; } else if (sfResultSet != null) // update count returned { if (resultSet != null) { openResultSets.add(resultSet); } resultSet = null; try { updateCount = ResultUtil.calculateUpdateCount(sfResultSet); } catch (SFException ex) { throw new SnowflakeSQLException(ex); } return false; } else // no more results { updateCount = NO_UPDATES; return false; } }
Example 12
Source File: Results.java From mariadb-connector-j with GNU Lesser General Public License v2.1 | 4 votes |
/** * Position to next resultSet. * * @param current one of the following <code>Statement</code> constants indicating what should * happen to current <code>ResultSet</code> objects obtained using the method <code> * getResultSet</code>: <code>Statement.CLOSE_CURRENT_RESULT</code>, <code> * Statement.KEEP_CURRENT_RESULT</code>, or <code>Statement.CLOSE_ALL_RESULTS</code> * @param protocol current protocol * @return true if other resultSet exists. * @throws SQLException if any connection error occur. */ public boolean getMoreResults(final int current, Protocol protocol) throws SQLException { if (fetchSize != 0 && resultSet != null) { protocol.getLock().lock(); try { // load current resultSet if (current == Statement.CLOSE_CURRENT_RESULT && resultSet != null) { resultSet.close(); } else { resultSet.fetchRemaining(); } // load next data if there is if (protocol.hasMoreResults()) { protocol.getResult(this); } } catch (SQLException e) { throw ExceptionFactory.INSTANCE.create(e); } finally { protocol.getLock().unlock(); } } if (cmdInformation.moreResults() && !batch) { if (current == Statement.CLOSE_CURRENT_RESULT && resultSet != null) { resultSet.close(); } if (executionResults != null) { resultSet = executionResults.poll(); } return resultSet != null; } else { if (current == Statement.CLOSE_CURRENT_RESULT && resultSet != null) { resultSet.close(); } resultSet = null; return false; } }