| 19 | */ |
| 20 | public final class DbDelete extends DbAccessFn { |
| 21 | @Override |
| 22 | public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { |
| 23 | final Data data = toData(qc); |
| 24 | final String path = toDbPath(arg(1), qc); |
| 25 | |
| 26 | // delete XML resources |
| 27 | final Updates updates = qc.updates(); |
| 28 | for(final int pre : data.resources.docs(path).toArray()) { |
| 29 | updates.add(new DeleteNode(pre, data, info), qc); |
| 30 | } |
| 31 | // delete file resources |
| 32 | for(final ResourceType type : Resources.BINARIES) { |
| 33 | final IOFile bin = data.meta.file(path, type); |
| 34 | if(bin != null) updates.add(new DBDelete(data, bin, info), qc); |
| 35 | } |
| 36 | return Empty.VALUE; |
| 37 | } |
| 38 | } |