public boolean previous() throws SqlJetException { return !(eof = !cursor.next()); }
@Override public Set<String> execute(SqlJetDb database) throws SqlJetException { Set<String> set = new TreeSet<>(); ISqlJetTable table = database.getTable(STATE_TABLE); ISqlJetCursor cursor = table.lookup(table.getPrimaryKeyIndexName()); try { if (!cursor.eof()) { do { set.add(cursor.getString(DATABASE_COLUMN)); } while (cursor.next()); } return set; } finally { close(cursor); } } };
cursor.next();
cursor.next();
private static Map<SvnChecksum, Integer> calculateCorrectChecksumRefcounts(SVNWCDbRoot root) throws SVNException { Map<SvnChecksum, Integer> checksumToRefCount = new HashMap<SvnChecksum, Integer>(); final SqlJetDb db = root.getSDb().getDb(); try { final ISqlJetTable nodesTable = db.getTable(SVNWCDbSchema.NODES.name()); db.beginTransaction(SqlJetTransactionMode.READ_ONLY); final ISqlJetCursor cursor = nodesTable.open(); for (; !cursor.eof(); cursor.next()) { String sha1ChecksumString = cursor.getString(SVNWCDbSchema.NODES__Fields.checksum.name()); if (sha1ChecksumString == null) { continue; } SvnChecksum sha1Checksum = SvnChecksum.fromString(sha1ChecksumString); Integer refCount = checksumToRefCount.get(sha1Checksum); int incrementedRefCount = refCount == null ? 1 : refCount + 1; checksumToRefCount.put(sha1Checksum, incrementedRefCount); } cursor.close(); } catch (SqlJetException e) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.WC_DB_ERROR, e); SVNErrorManager.error(errorMessage, e, SVNLogType.WC); } finally { try { db.commit(); } catch (SqlJetException ignore) { } } return checksumToRefCount; }
cursor.next();
@Override public void update(State state) { try { db.beginTransaction(SqlJetTransactionMode.WRITE); try { ISqlJetTable table = db.getTable(StateTable.TABLE_NAME); ISqlJetCursor cursor = table.lookup(StateTable.NDX_FULL_NAME, state.fullname); while (!cursor.eof()) { cursor.update(getData(state)); cursor.next(); } cursor.close(); } finally { db.commit(); } } catch (Throwable e) { logger.error("unable to update: " + state, e); } }
private static Map<SvnChecksum, Integer> loadChecksumsRefcountsFromTable(SVNWCDbRoot root) throws SVNException { Map<SvnChecksum, Integer> checksumToRefCount = new HashMap<SvnChecksum, Integer>(); final SqlJetDb db = root.getSDb().getDb(); try { final ISqlJetTable pristineTable = db.getTable(SVNWCDbSchema.PRISTINE.name()); db.beginTransaction(SqlJetTransactionMode.READ_ONLY); final ISqlJetCursor cursor = pristineTable.open(); for (; !cursor.eof(); cursor.next()) { String sha1ChecksumString = cursor.getString(PRISTINE__Fields.checksum.name()); if (sha1ChecksumString == null) { continue; } SvnChecksum sha1Checksum = SvnChecksum.fromString(sha1ChecksumString); long refcount = cursor.getInteger(PRISTINE__Fields.refcount.name()); checksumToRefCount.put(sha1Checksum, (int)refcount); } cursor.close(); } catch (SqlJetException e) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.WC_DB_ERROR, e); SVNErrorManager.error(errorMessage, e, SVNLogType.WC); } finally { try { db.commit(); } catch (SqlJetException ignore) { } } return checksumToRefCount; }
public boolean next() throws SVNException { try { if (getCursor() == null) { sDb.beginTransaction(transactionMode); try { setCursor(openCursor()); return !getCursor().eof(); } catch (SVNException e) { if (getCursor() == null) { sDb.commit(); } throw e; } } return getCursor().next(); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return false; } }
break; cursor.next();
while (cursor.next());