public long updateVector(LSHVector vec, int countDiff) throws SQLException {

		if (countDiff <= 0) {
			throw new IllegalArgumentException("Invalid countDiff: " + countDiff);
		}

		// TODO: it may be possible to optimize the technique employed here

		PreparedStatement s = update_by_hash_stmt.prepareIfNeeded(() -> db.prepareStatement(
			"UPDATE " + TABLE_NAME + " SET count = count + ? WHERE vec_hash = ?"));
		long vecHash = vec.calcUniqueHash();
		s.setInt(1, countDiff);
		s.setLong(2, vecHash);
		int rc = s.executeUpdate();
		if (rc == 0) {
			return insert(countDiff, vec);
		}
		if (rc > 1) {
			throw new SQLException("Unexpected updated row count: " + rc);
		}

		s = select_id_by_hash_stmt.prepareIfNeeded(() -> db
				.prepareStatement("SELECT id, count FROM " + TABLE_NAME + " WHERE vec_hash = ?"));
		s.setLong(1, vecHash);

		long id;
		int count;
		try (ResultSet rs = s.executeQuery()) {
			if (!rs.next()) {
				throw new SQLException("Unknown vector hash");
			}
			id = rs.getLong(1);
			count = rs.getInt(2);
		}
		vectorStore.update(
			new VectorStoreEntry(id, vec, count, vectorFactory.getSelfSignificance(vec)));
		return id;
	}
Update or insert vector table entry with the specified positive countDiff. 
@param vec vector
@param countDiff positive vector count change
@return vector ID which was updated or created
@throws SQLException if an error occurs
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/file/H2VectorTable.java