@Override public boolean next() throws SQLException { checkOpen(); // TODO: Resolve following comments (possibly obsolete because of later // addition of preceding call to checkOpen. Also, NOTE that the // following check, and maybe some checkOpen() calls, probably must // synchronize on the statement, per the comment on AvaticaStatement's // openResultSet: // Next may be called after close has been called (for example after a user // cancellation) which in turn sets the cursor to null. So we must check // before we call next. // TODO: handle next() after close is called in the Avatica code. if (cursor != null) { return super.next(); } else { return false; } }
@Override public boolean next() throws SQLException { throwIfClosed(); // TODO: Resolve following comments (possibly obsolete because of later // addition of preceding call to throwIfClosed. Also, NOTE that the // following check, and maybe some throwIfClosed() calls, probably must // synchronize on the statement, per the comment on AvaticaStatement's // openResultSet: // Next may be called after close has been called (for example after a user // cancellation) which in turn sets the cursor to null. So we must check // before we call next. // TODO: handle next() after close is called in the Avatica code. if (cursor != null) { return super.next(); } else { return false; } }
@Override public boolean next() throws SQLException { checkOpen(); // TODO: Resolve following comments (possibly obsolete because of later // addition of preceding call to checkOpen. Also, NOTE that the // following check, and maybe some checkOpen() calls, probably must // synchronize on the statement, per the comment on AvaticaStatement's // openResultSet: // Next may be called after close has been called (for example after a user // cancellation) which in turn sets the cursor to null. So we must check // before we call next. // TODO: handle next() after close is called in the Avatica code. if (cursor != null) { return super.next(); } else { return false; } }
/** Returns whether a a statement is capable of updates and if so, * and the statement's {@code updateCount} is still -1, proceeds to * get updateCount value from statement's resultSet. * * <p>Handles "ROWCOUNT" object as Number or List * * @param statement Statement * @throws SQLException on error */ private void isUpdateCapable(final AvaticaStatement statement) throws SQLException { Meta.Signature signature = statement.getSignature(); if (signature == null || signature.statementType == null) { return; } if (signature.statementType.canUpdate() && statement.updateCount == -1) { statement.openResultSet.next(); Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME); if (obj instanceof Number) { statement.updateCount = ((Number) obj).intValue(); } else if (obj instanceof List) { statement.updateCount = ((Number) ((List<Object>) obj).get(0)).intValue(); } else { throw helper.createException("Not a valid return result."); } statement.openResultSet = null; } }
/** Returns whether a a statement is capable of updates and if so, * and the statement's {@code updateCount} is still -1, proceeds to * get updateCount value from statement's resultSet. * * <p>Handles "ROWCOUNT" object as Number or List * * @param statement Statement * @throws SQLException on error */ private void isUpdateCapable(final AvaticaStatement statement) throws SQLException { Meta.Signature signature = statement.getSignature(); if (signature == null || signature.statementType == null) { return; } if (signature.statementType.canUpdate() && statement.updateCount == -1) { statement.openResultSet.next(); Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME); if (obj instanceof Number) { statement.updateCount = ((Number) obj).intValue(); } else if (obj instanceof List) { @SuppressWarnings("unchecked") final List<Number> numbers = (List<Number>) obj; statement.updateCount = numbers.get(0).intValue(); } else { throw HELPER.createException("Not a valid return result."); } statement.openResultSet = null; } }
/** Returns whether a a statement is capable of updates and if so, * and the statement's {@code updateCount} is still -1, proceeds to * get updateCount value from statement's resultSet. * * <p>Handles "ROWCOUNT" object as Number or List * * @param statement Statement * @throws SQLException on error */ private void isUpdateCapable(final AvaticaStatement statement) throws SQLException { Meta.Signature signature = statement.getSignature(); if (signature == null || signature.statementType == null) { return; } if (signature.statementType.canUpdate() && statement.updateCount == -1) { statement.openResultSet.next(); Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME); if (obj instanceof Number) { statement.updateCount = ((Number) obj).intValue(); } else if (obj instanceof List) { @SuppressWarnings("unchecked") final List<Number> numbers = (List<Number>) obj; statement.updateCount = numbers.get(0).intValue(); } else { throw HELPER.createException("Not a valid return result."); } statement.openResultSet = null; } }