public String getText(int columnIndex) throws SqlJetException { if (result instanceof String && columnIndex == 0) { return (String) result; } return cursor.getString(columnIndex); }
public String getString(int field) throws SqlJetException { return cursor.getString(field); }
public String getString(String fieldName) throws SqlJetException { return cursor.getString(fieldName); }
private State read(ISqlJetCursor cursor) { try { String fullname = cursor.getString(StateTable.COL_FULL_NAME); String version = null; if (!cursor.isNull(StateTable.COL_VERSION)) version = cursor.getString(StateTable.COL_VERSION); return new State(fullname, version); } catch (SqlJetException e) { logger.error("unable to read", e); return null; } }
private SVNSkel getConflictSkel(ISqlJetCursor cursor) throws SqlJetException, SVNException { String conflictOldRelPath = cursor.getString(SVNWCDbSchema.ACTUAL_NODE__Fields.conflict_old.name()); String conflictNewRelPath = cursor.getString(SVNWCDbSchema.ACTUAL_NODE__Fields.conflict_new.name()); String conflictWorkingRelPath = cursor.getString(SVNWCDbSchema.ACTUAL_NODE__Fields.conflict_working.name()); String propRejectRelPath = cursor.getString(SVNWCDbSchema.ACTUAL_NODE__Fields.prop_reject.name()); byte[] treeConflictData = cursor.getBlobAsArray(SVNWCDbSchema.ACTUAL_NODE__Fields.tree_conflict_data.name()); return SvnWcDbConflicts.convertToConflictSkel(conflictOldRelPath, conflictWorkingRelPath, conflictNewRelPath, propRejectRelPath, treeConflictData); } }
public void beforeDelete(ISqlJetCursor cursor) throws SqlJetException { String checksumValue = cursor.getString(NODES__Fields.checksum.toString()); changeRefCount(checksumValue, -1); }
public void beforeUpdate(ISqlJetCursor cursor, Map<String, Object> values) throws SqlJetException { if (values.containsKey(NODES__Fields.checksum.toString())) { String newChecksum = (String) values.get(NODES__Fields.checksum.toString()); String oldChecksum = (String) cursor.getString(NODES__Fields.checksum.toString()); changeRefCount(oldChecksum,-1); changeRefCount(newChecksum, 1); } }
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); }
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; } }
@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); } } };
final String conflictOld = actulaNode.getString(ACTUAL_NODE__Fields.conflict_old.toString()); final String conflictWorking = actulaNode.getString(ACTUAL_NODE__Fields.conflict_working.toString()); final String conflictNew = actulaNode.getString(ACTUAL_NODE__Fields.conflict_new.toString()); final String propReject = actulaNode.getString(ACTUAL_NODE__Fields.prop_reject.toString()); final byte[] treeConflictData = actulaNode.getBlobAsArray(ACTUAL_NODE__Fields.tree_conflict_data.toString()); continue; final String localRelpath = actulaNode.getString(ACTUAL_NODE__Fields.local_relpath.toString()); final SVNSkel conflictData = SvnWcDbConflicts.convertToConflictSkel(wcRootAbsPath, db, localRelpath, conflictOld, conflictWorking, conflictNew, propReject, treeConflictData);
public void beforeDelete(ISqlJetCursor cursor) throws SqlJetException { ISqlJetTable table = db.getDb().getTemporaryDatabase().getTable(SVNWCDbSchema.REVERT_LIST.toString()); Map<String, Object> rowValues = new HashMap<String, Object>(); rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.local_relpath.toString(), cursor.getValue(SVNWCDbSchema.ACTUAL_NODE__Fields.local_relpath.toString())); rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.actual.toString(), 1); rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.conflict_data.toString(), getConflictData(cursor)); if (!cursor.isNull(SVNWCDbSchema.ACTUAL_NODE__Fields.properties.toString()) || !cursor.isNull(SVNWCDbSchema.ACTUAL_NODE__Fields.tree_conflict_data.toString())) { rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.notify.toString(), 1); } else if (!exists(db.getDb(), cursor.getInteger(SVNWCDbSchema.ACTUAL_NODE__Fields.wc_id.toString()), cursor.getString(SVNWCDbSchema.ACTUAL_NODE__Fields.local_relpath.toString()))) { rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.notify.toString(), 1); } else { rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.notify.toString(), null); } table.insertByFieldNamesOr(SqlJetConflictAction.REPLACE, rowValues); }
public void beforeUpdate(ISqlJetCursor cursor, Map<String, Object> newValues) throws SqlJetException { ISqlJetTable table = db.getDb().getTemporaryDatabase().getTable(SVNWCDbSchema.REVERT_LIST.toString()); Map<String, Object> rowValues = new HashMap<String, Object>(); rowValues.put(REVERT_LIST__Fields.local_relpath.toString(), cursor.getValue(ACTUAL_NODE__Fields.local_relpath.toString())); rowValues.put(REVERT_LIST__Fields.actual.toString(), 1); rowValues.put(REVERT_LIST__Fields.conflict_data.toString(), cursor.getBlobAsArray(ACTUAL_NODE__Fields.conflict_data.toString())); if (!cursor.isNull(ACTUAL_NODE__Fields.properties.toString()) || !cursor.isNull(ACTUAL_NODE__Fields.tree_conflict_data.toString())) { rowValues.put(REVERT_LIST__Fields.notify.toString(), 1); } else if (!exists(db.getDb().getTemporaryDatabase(), cursor.getInteger(ACTUAL_NODE__Fields.wc_id.toString()), cursor.getString(ACTUAL_NODE__Fields.local_relpath.toString()))) { rowValues.put(REVERT_LIST__Fields.notify.toString(), 1); } else { rowValues.put(REVERT_LIST__Fields.notify.toString(), null); } table.insertByFieldNamesOr(SqlJetConflictAction.REPLACE, rowValues); }
public void beforeUpdate(ISqlJetCursor cursor, Map<String, Object> newValues) throws SqlJetException { ISqlJetTable table = db.getDb().getTemporaryDatabase().getTable(SVNWCDbSchema.REVERT_LIST.toString()); Map<String, Object> rowValues = new HashMap<String, Object>(); rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.local_relpath.toString(), cursor.getValue(SVNWCDbSchema.ACTUAL_NODE__Fields.local_relpath.toString())); rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.actual.toString(), 1); rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.conflict_data.toString(), getConflictData(cursor)); if (!cursor.isNull(SVNWCDbSchema.ACTUAL_NODE__Fields.properties.toString()) || !cursor.isNull(SVNWCDbSchema.ACTUAL_NODE__Fields.tree_conflict_data.toString())) { rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.notify.toString(), 1); } else if (!exists(db.getDb().getTemporaryDatabase(), cursor.getInteger(SVNWCDbSchema.ACTUAL_NODE__Fields.wc_id.toString()), cursor.getString(SVNWCDbSchema.ACTUAL_NODE__Fields.local_relpath.toString()))) { rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.notify.toString(), 1); } else { rowValues.put(SVNWCDbSchema.REVERT_LIST__Fields.notify.toString(), null); } table.insertByFieldNamesOr(SqlJetConflictAction.REPLACE, rowValues); }
public void beforeDelete(ISqlJetCursor cursor) throws SqlJetException { ISqlJetTable table = db.getDb().getTemporaryDatabase().getTable(SVNWCDbSchema.REVERT_LIST.toString()); Map<String, Object> rowValues = new HashMap<String, Object>(); rowValues.put(REVERT_LIST__Fields.local_relpath.toString(), cursor.getValue(ACTUAL_NODE__Fields.local_relpath.toString())); rowValues.put(REVERT_LIST__Fields.actual.toString(), 1); rowValues.put(REVERT_LIST__Fields.conflict_data.toString(), cursor.getBlobAsArray(ACTUAL_NODE__Fields.conflict_data.toString())); if (!cursor.isNull(ACTUAL_NODE__Fields.properties.toString()) || !cursor.isNull(ACTUAL_NODE__Fields.tree_conflict_data.toString())) { rowValues.put(REVERT_LIST__Fields.notify.toString(), 1); } else if (!exists(db.getDb(), cursor.getInteger(ACTUAL_NODE__Fields.wc_id.toString()), cursor.getString(ACTUAL_NODE__Fields.local_relpath.toString()))) { rowValues.put(REVERT_LIST__Fields.notify.toString(), 1); } else { rowValues.put(REVERT_LIST__Fields.notify.toString(), null); } table.insertByFieldNamesOr(SqlJetConflictAction.REPLACE, rowValues); }
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; }
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; }
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; }
myHash = cursor.getString(HASH_FIELD);
myHash = cursor.getString(HASH_FIELD);