1package SQLite;
2
3/**
4 * Class to represent compiled SQLite VM.
5 */
6
7public class Vm {
8
9    /**
10     * Internal handle for the compiled SQLite VM.
11     */
12
13    private long handle = 0;
14
15    /**
16     * Internal last error code for compile()/step() methods.
17     */
18
19    protected int error_code = 0;
20
21    /**
22     * Perform one step on compiled SQLite VM.
23     * The result row is passed to the given callback interface.<BR><BR>
24     *
25     * Example:<BR>
26     * <PRE>
27     *   ...
28     *   try {
29     *     Vm vm = db.compile("select * from x; select * from y;");
30     *     while (vm.step(cb)) {
31     *       ...
32     *     }
33     *     while (vm.compile()) {
34     *       while (vm.step(cb)) {
35     *         ...
36     *       }
37     *     }
38     *   } catch (SQLite.Exception e) {
39     *   }
40     * </PRE>
41     *
42     * @param cb the object implementing the callback methods.
43     * @return true as long as more row data can be retrieved,
44     * false, otherwise.
45     */
46
47    public native boolean step(Callback cb) throws SQLite.Exception;
48
49    /**
50     * Compile the next SQL statement for the SQLite VM instance.
51     * @return true when SQL statement has been compiled, false
52     * on end of statement sequence.
53     */
54
55    public native boolean compile() throws SQLite.Exception;
56
57    /**
58     * Abort the compiled SQLite VM.
59     */
60
61    public native void stop() throws SQLite.Exception;
62
63    /**
64     * Destructor for object.
65     */
66
67    protected native void finalize();
68
69    /**
70     * Internal native initializer.
71     */
72
73    private static native void internal_init();
74
75    static {
76	internal_init();
77    }
78}
79