void showItems(Cursor items) { if (items.size() > 0) { mAdapter.switchCursor(items); if (R.id.list == mListSwitcher.getNextView().getId()) { mListSwitcher.showNext(); } } else if (R.id.text_empty == mListSwitcher.getNextView().getId()) { mListSwitcher.showNext(); } }
cp = ContainerPolicy.buildPolicyFor(ClassConstants.Vector_class); cursor.setSession(unitOfWork); result = cursor.getObjectCollection(); cursor.setInitiallyConformingIndex(indexedInterimResult); cursor.setSelectionCriteriaClone(getSelectionCriteria()); cursor.setTranslationRow(arguments); cursor.setObjectCollection((Vector)conformedResult); for (Enumeration enumtr = cursor.getObjectCollection().elements(); enumtr.hasMoreElements();) { Object clone = enumtr.nextElement();
/** * INTERNAL: * CR#4139 * Read the previous row from the result set. It is used solely * for scrollable cursor support. */ protected Object retrievePreviousObject() throws DatabaseException { while (true) { if (isClosed()) { return null; } AbstractRecord row = getAccessor().cursorRetrievePreviousRow(getFields(), getResultSet(), getExecutionSession()); if (row == null) { if (!(this instanceof ScrollableCursor)) { close(); } return null; } Object object = buildAndRegisterObject(row); if (object == InvalidObject.instance) { continue; } return object; } }
RuntimeException exception = null; try { if (isClosed()) { return; getAccessor().closeCursor(getResultSet(), getSession()); getAccessor().closeStatement(getStatement(), getSession(), null); } catch (RuntimeException caughtException) { exception = caughtException; getSession().releaseReadConnection(getQuery().getAccessor()); } catch (RuntimeException releaseException) { if (exception == null) { setResultSet(null); } catch (SQLException sqlException) { throw DatabaseException.sqlException(sqlException, getAccessor(), getSession(), false);
AbstractSession session = cursor.getExecutionSession(); AbstractRecord nextRow = null; if (forward) { nextRow = cursor.getAccessor().cursorRetrieveNextRow(cursor.getFields(), cursor.getResultSet(), session); } else { nextRow = cursor.getAccessor().cursorRetrievePreviousRow(cursor.getFields(), cursor.getResultSet(), session);
cursor = (Cursor)result; cursor.setSession(unitOfWork); cp = ContainerPolicy.buildPolicyFor(ClassConstants.Vector_class); result = cursor.getObjectCollection(); cursor.setObjectCollection((Vector)clones); return cursor; } else {
RuntimeException exception = null; try { if (isClosed()) { return; getAccessor().closeCursor(this.resultSet, this.session); getAccessor().closeStatement(this.statement, this.session, null); } catch (RuntimeException caughtException) { exception = caughtException; this.nextRow = null; } catch (SQLException sqlException) { throw DatabaseException.sqlException(sqlException, getAccessor(), getSession(), false);
/** * INTERNAL: * builds and registers an object from a row for cursors. * Behavior is different from the query version in that refreshing is not * supported. */ protected Object buildAndRegisterObject(AbstractRecord row) { Object object = null; if (getSession().isUnitOfWork() && (!getQuery().isReportQuery()) && (getQuery().shouldMaintainCache()) && (getQuery().isObjectLevelReadQuery())) { UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)getSession(); ObjectLevelReadQuery query = (ObjectLevelReadQuery)getQuery(); if (query.shouldConformResultsInUnitOfWork() || query.getDescriptor().shouldAlwaysConformResultsInUnitOfWork()) { object = query.conformIndividualResult(row, unitOfWork, getTranslationRow(), getSelectionCriteriaClone(), getInitiallyConformingIndex(), true); // Notifies caller to continue until conforming instance found if (object == null) { return InvalidObject.instance; } } else { // This will now automatically clone the result. object = query.buildObject(row); } } else { object = getQuery().buildObject(row); } return object; }
/** * Close in case not closed. */ protected void finalize() throws DatabaseException { close(); }
/** * PUBLIC: * Retrieve the size of the open cursor by executing a count on the same query as the cursor. * * If this cursor is conforming size() can only be an estimate. cursor size * plus number of conforming instances found in memory will be returned. The * union (actual result) may be smaller than this. */ public int size() throws DatabaseException { if (size == -1) { size = getCursorSize(); if (getInitiallyConformingIndex() != null) { size += getInitiallyConformingIndex().size(); } } return size; } }
/** * PUBLIC: * Retrieve the size of the open cursor by executing a count on the same query as the cursor. * * If this cursor is conforming size() can only be an estimate. cursor size * plus number of conforming instances found in memory will be returned. The * union (actual result) may be smaller than this. */ public int size() throws DatabaseException { if (this.size == -1) { this.size = getCursorSize(); if (this.initiallyConformingIndex != null) { this.size += this.initiallyConformingIndex.size(); } } return this.size; }
/** * PUBLIC: * Return if the stream is closed. */ public boolean isClosed() { return (getResultSet() == null); }
cp = ContainerPolicy.buildPolicyFor(ClassConstants.Vector_class); cursor.setSession(unitOfWork); result = cursor.getObjectCollection(); cursor.setInitiallyConformingIndex(indexedInterimResult); cursor.setSelectionCriteriaClone(getSelectionCriteria()); cursor.setTranslationRow(arguments); cursor.setObjectCollection((List)conformedResult); for (Object clone : cursor.getObjectCollection()) { indexedInterimResult.put(clone, clone);
/** * INTERNAL: * Read the next row from the result set. */ protected Object retrieveNextObject() throws DatabaseException { while (true) { if (isClosed()) { return null; } AbstractRecord row = getAccessor().cursorRetrieveNextRow(getFields(), getResultSet(), getExecutionSession()); if (row == null) { if (!(this instanceof ScrollableCursor)) { close(); } return null; } Object object = buildAndRegisterObject(row); if (object == InvalidObject.instance) { continue; } return object; } }
AbstractSession session = cursor.getExecutionSession(); AbstractRecord nextRow = null; if (forward) { nextRow = cursor.getAccessor().cursorRetrieveNextRow(cursor.getFields(), cursor.getResultSet(), session); } else { nextRow = cursor.getAccessor().cursorRetrievePreviousRow(cursor.getFields(), cursor.getResultSet(), session);
cursor = (Cursor)result; cursor.setSession(unitOfWork); cp = ContainerPolicy.buildPolicyFor(ClassConstants.Vector_class); result = cursor.getObjectCollection(); cursor.setObjectCollection((Vector)clones); return cursor; } else {
RuntimeException exception = null; try { if (isClosed()) { return; getAccessor().closeCursor(this.resultSet, this.session); getAccessor().closeStatement(this.statement, this.session, null); } catch (RuntimeException caughtException) { exception = caughtException; this.nextRow = null; } catch (SQLException sqlException) { throw DatabaseException.sqlException(sqlException, getAccessor(), getSession(), false);
/** * Close in case not closed. */ protected void finalize() throws DatabaseException { close(); }
/** * PUBLIC: * Retrieve the size of the open cursor by executing a count on the same query as the cursor. * * If this cursor is conforming size() can only be an estimate. cursor size * plus number of conforming instances found in memory will be returned. The * union (actual result) may be smaller than this. */ public int size() throws DatabaseException { if (this.size == -1) { this.size = getCursorSize(); if (this.initiallyConformingIndex != null) { this.size += this.initiallyConformingIndex.size(); } } return this.size; }
cp = ContainerPolicy.buildPolicyFor(ClassConstants.Vector_class); cursor.setSession(unitOfWork); result = cursor.getObjectCollection(); cursor.setInitiallyConformingIndex(indexedInterimResult); cursor.setSelectionCriteriaClone(getSelectionCriteria()); cursor.setTranslationRow(arguments); cursor.setObjectCollection((List)conformedResult); for (Object clone : cursor.getObjectCollection()) { indexedInterimResult.put(clone, clone);