01: package com.db4o.f1;
02:
03: import com.db4o.*;
04:
05: public class Util {
06: public final static String DB4OFILENAME = "formula1.db4o";
07:
08: public static void listResult(ObjectSet result) {
09: System.out.println(result.size());
10: while (result.hasNext()) {
11: System.out.println(result.next());
12: }
13: }
14:
15: public static void listResult(java.util.List result) {
16: System.out.println(result.size());
17: for (int x = 0; x < result.size(); x++)
18: System.out.println(result.get(x));
19: }
20:
21: public static void listRefreshedResult(ObjectContainer container,
22: ObjectSet result, int depth) {
23: System.out.println(result.size());
24: while (result.hasNext()) {
25: Object obj = result.next();
26: container.ext().refresh(obj, depth);
27: System.out.println(obj);
28: }
29: }
30:
31: public static void retrieveAll(ObjectContainer db) {
32: ObjectSet result = db.get(new Object());
33: listResult(result);
34: }
35:
36: public static void deleteAll(ObjectContainer db) {
37: ObjectSet result = db.get(new Object());
38: while (result.hasNext()) {
39: db.delete(result.next());
40: }
41: }
42: }
|