public SVNWCDbInsertDeleteList(SVNSqlJetDb sDb) throws SVNException {
    super(sDb.getTemporaryDb(), SVNWCDbSchema.DELETE_LIST);

    this.select =
        new SVNSqlJetSelectStatement(sDb, SVNWCDbSchema.NODES) {
          @Override
          protected Object[] getWhere() throws SVNException {
            return new Object[] {getBind(1)};
          }

          private boolean isMaxOpDepth(long opDepth) throws SVNException {
            SVNWCDbNodesMaxOpDepth stmt = new SVNWCDbNodesMaxOpDepth(sDb, 0);
            Long maxOpDepth =
                stmt.getMaxOpDepth(
                    (Long) getBind(1), getColumnString(SVNWCDbSchema.NODES__Fields.local_relpath));
            return maxOpDepth != null && maxOpDepth == opDepth;
          }

          @Override
          protected boolean isFilterPassed() throws SVNException {
            final ISVNWCDb.SVNWCDbStatus presence = SvnWcDbStatementUtil.getColumnPresence(this);
            if (presence == ISVNWCDb.SVNWCDbStatus.BaseDeleted
                || presence == ISVNWCDb.SVNWCDbStatus.NotPresent
                || presence == ISVNWCDb.SVNWCDbStatus.Excluded
                || presence == ISVNWCDb.SVNWCDbStatus.ServerExcluded) {
              return false;
            }
            long selectOpDepth = (Long) getBind(3);
            long rowOpDepth = getColumnLong(NODES__Fields.op_depth);
            return rowOpDepth >= selectOpDepth && isMaxOpDepth(rowOpDepth);
          }

          @Override
          protected String getPathScope() {
            return (String) getBind(2);
          }
        };
  }