File: Backup.java

package info (click to toggle)
db5.3 5.3.28%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 158,500 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,264; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,077; javascript: 1,998; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (99 lines) | stat: -rw-r--r-- 1,700 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package SQLite;

/**
 * Class wrapping an SQLite backup object.
 */

public class Backup {

    /**
     * Internal handle for the native SQLite API.
     */

    protected long handle = 0;

    /**
     * Finish a backup.
     */

    protected void finish() throws SQLite.Exception {
	synchronized(this) {
	    _finalize();
	}
    }

    /**
     * Destructor for object.
     */

    protected void finalize() {
	synchronized(this) {
	    try {
		_finalize();
	    } catch (SQLite.Exception e) {
	    }
	}
    }

    protected native void _finalize() throws SQLite.Exception;

    /**
     * Perform a backup step.
     *
     * @param n number of pages to backup
     * @return true when backup completed
     */

    public boolean step(int n) throws SQLite.Exception {
	synchronized(this) {
	    return _step(n);
	}
    }

    private native boolean _step(int n) throws SQLite.Exception;

    /**
     * Perform the backup in one step.
     */

    public void backup() throws SQLite.Exception {
	synchronized(this) {
	    _step(-1);
	}
    }

    /**
     * Return number of remaining pages to be backed up.
     */

    public int remaining() throws SQLite.Exception {
	synchronized(this) {
	    return _remaining();
	}
    }

    private native int _remaining() throws SQLite.Exception;

    /**
     * Return the total number of pages in the backup source database.
     */

    public int pagecount() throws SQLite.Exception {
	synchronized(this) {
	    return _pagecount();
	}
    }

    private native int _pagecount() throws SQLite.Exception;

    /**
     * Internal native initializer.
     */

    private static native void internal_init();

    static {
	internal_init();
    }
}