public void delete() throws SqlJetException { if (!eof) { cursor.delete(); eof = cursor.eof(); } }
private boolean exists(SqlJetDb db, long wcId, String localRelPath) throws SqlJetException { ISqlJetTable table = db.getTable(SVNWCDbSchema.NODES.name()); ISqlJetCursor cursor = table.lookup(null, wcId, localRelPath); try { return !cursor.eof(); } finally { cursor.close(); } }
private boolean exists(SqlJetDb db, long wcId, String localRelPath) throws SqlJetException { ISqlJetTable table = db.getTable(SVNWCDbSchema.NODES.name()); ISqlJetCursor cursor = table.lookup(null, wcId, localRelPath); try { return !cursor.eof(); } finally { cursor.close(); } } }
protected long getColumnLong(String f) throws SVNException { try { if (getCursor() == null || getCursor().eof()) return 0; return getCursor().getInteger(f); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return 0; } }
public void beforeInsert(SqlJetConflictAction conflictAction, ISqlJetTable table, Map<String, Object> newValues) throws SqlJetException { if (conflictAction == SqlJetConflictAction.REPLACE) { Object o1 = newValues.get(NODES__Fields.wc_id.toString()); Object o2 = newValues.get(NODES__Fields.local_relpath.toString()); Object o3 = newValues.get(NODES__Fields.op_depth.toString()); ISqlJetCursor cursor = table.lookup(null, new Object[] {o1, o2, o3}); try { if (!cursor.eof()) { changeRefCount(cursor.getString(NODES__Fields.checksum.toString()), -1); } } finally { cursor.close(); } } String newChecksumValue = (String) newValues.get(NODES__Fields.checksum.toString()); changeRefCount(newChecksumValue, 1); }
public long count() throws SVNException { try { if (getCursor() == null || getCursor().eof()) return 0; return getCursor().getRowCount(); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return 0; } }
protected Object getColumn(String f) throws SVNException { try { if (getCursor() == null || getCursor().eof()) return null; return getCursor().getValue(f); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return null; } }
@Override public void execute(SqlJetDb db) throws SqlJetException { ISqlJetTable table = db.getTable(INVOKER_TABLE); ISqlJetCursor cursor = table.lookup(table.getPrimaryKeyIndexName(), transactionId, phase, databaseId); try { if (!cursor.eof()) { cursor.updateByFieldNames(Collections.<String, Object>singletonMap(RESULT_COLUMN, result)); } } finally { close(cursor); } } };
protected String getColumnString(String f) throws SVNException { try { if (getCursor() == null || getCursor().eof()) return null; return getCursor().getString(f); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return null; } }
protected boolean isColumnNull(String f) throws SVNException { try { if (getCursor() == null || getCursor().eof()) return true; return getCursor().isNull(f); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return false; } }
protected byte[] getColumnBlob(String f) throws SVNException { try { if (getCursor() == null || getCursor().eof()) return null; return getCursor().getBlobAsArray(f); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return null; } }
public boolean eof() throws SVNException { try { if (getCursor() == null) { sDb.beginTransaction(transactionMode); setCursor(openCursor()); } return getCursor().eof(); } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); return false; } }
@Override public void execute(SqlJetDb db) throws SqlJetException { ISqlJetTable table = db.getTable(STATE_TABLE); ISqlJetCursor cursor = table.lookup(table.getPrimaryKeyIndexName(), event.getSource()); try { if (!cursor.eof()) { cursor.delete(); } } finally { close(cursor); } } };
private String getNodeReposRelpath(long wcId, String path) throws SVNException { ISqlJetCursor cursor = null; try { cursor = getTable().lookup(null, wcId, path); if (!cursor.eof()) { return cursor.getString(NODES__Fields.repos_path.toString()); } } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); } finally { if (cursor != null) { try { cursor.close(); } catch (SqlJetException e) { } } } return null; }
@Override public void delete(String fullname) { try { db.beginTransaction(SqlJetTransactionMode.WRITE); try { ISqlJetTable table = db.getTable(StateTable.TABLE_NAME); ISqlJetCursor cursor = table.lookup(StateTable.NDX_FULL_NAME, fullname); while (!cursor.eof()) { cursor.delete(); } cursor.close(); } finally { db.commit(); } } catch (Throwable e) { logger.error("unable to delete: " + fullname, e); } }
public Long getMaxOpDepth(Long wcId, String localRelpath) throws SVNException { ISqlJetCursor c = null; try { c = getTable().lookup(null, wcId, localRelpath); c = c.reverse(); if (!c.eof()) { long rowDepth = c.getInteger(SVNWCDbSchema.NODES__Fields.op_depth.toString()); if (rowDepth >= minDepth) { return rowDepth; } } } catch (SqlJetException e) { SVNSqlJetDb.createSqlJetError(e); } finally { try { c.close(); } catch (SqlJetException e) { } } return null; }
private FSRepresentationCacheRecord getByHash(final String hash) throws SVNException { ISqlJetCursor lookup = null; try { lookup = myTable.lookup(myTable.getPrimaryKeyIndexName(), new Object[] { hash }); if (!lookup.eof()) { return new FSRepresentationCacheRecord(lookup); } } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } finally { if (lookup != null) { try { lookup.close(); } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } } } return null; }
private FSRepresentationCacheRecord getByHash(final String hash) throws SVNException { ISqlJetCursor lookup = null; try { lookup = myTable.lookup(myTable.getPrimaryKeyIndexName(), new Object[] { hash }); if (!lookup.eof()) { return new FSRepresentationCacheRecord(lookup); } } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } finally { if (lookup != null) { try { lookup.close(); } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } } } return null; }
private FSRepresentationCacheRecord getByHash(final String hash) throws SVNException { ISqlJetCursor lookup = null; try { lookup = myTable.lookup(myTable.getPrimaryKeyIndexName(), new Object[] { hash }); if (!lookup.eof()) { return new FSRepresentationCacheRecord(lookup); } } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } finally { if (lookup != null) { try { lookup.close(); } catch (SqlJetException e) { SVNErrorManager.error(convertError(e), SVNLogType.FSFS); } } } return null; }
@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); } }