1417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughespackage SQLite;
2417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
3417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes/**
4417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * Class to represent compiled SQLite3 statement.
5417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes *
6417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * Note, that all native methods of this class are
7417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * not synchronized, i.e. it is up to the caller
8417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * to ensure that only one thread is in these
9417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes * methods at any one time.
10417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes */
11417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
12417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughespublic class Stmt {
13417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
14417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
15417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Internal handle for the SQLite3 statement.
16417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
17417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
18417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    private long handle = 0;
19417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
20417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
21417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Internal last error code for prepare()/step() methods.
22417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
23417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
24417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    protected int error_code = 0;
25417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
26417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
27417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Prepare the next SQL statement for the Stmt instance.
28417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return true when the next piece of the SQL statement sequence
29417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * has been prepared, false on end of statement sequence.
30417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
31417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
32417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native boolean prepare() throws SQLite.Exception;
33417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
34417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
35417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Perform one step of compiled SQLite3 statement.
36417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *
37417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Example:<BR>
38417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * <PRE>
39417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *   ...
40417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *   try {
41417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     Stmt s = db.prepare("select * from x; select * from y;");
42417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     s.bind(...);
43417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     ...
44417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     s.bind(...);
45417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     while (s.step(cb)) {
46417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *       Object o = s.value(...);
47417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *       ...
48417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     }
49417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     // s.reset() for re-execution or
50417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     // s.prepare() for the next piece of SQL
51417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     while (s.prepare()) {
52417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *       s.bind(...);
53417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *       ...
54417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *       s.bind(...);
55417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *       while (s.step(cb)) {
56417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *         Object o = s.value(...);
57417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *         ...
58417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *       }
59417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     }
60417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *   } catch (SQLite.Exception e) {
61417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *     s.close();
62417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *   }
63417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * </PRE>
64417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     *
65417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return true when row data is available, false on end
66417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * of result set.
67417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
68417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
69417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native boolean step() throws SQLite.Exception;
70417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
71417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
72417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Close the compiled SQLite3 statement.
73417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
74417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
75417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void close() throws SQLite.Exception;
76417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
77417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
78417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Reset the compiled SQLite3 statement without
79417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * clearing parameter bindings.
80417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
81417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
82417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void reset() throws SQLite.Exception;
83417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
84417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
85417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Clear all bound parameters of the compiled SQLite3 statement.
86417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
87417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
88417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void clear_bindings() throws SQLite.Exception;
89417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
90417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
91417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Bind positional integer value to compiled SQLite3 statement.
92417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
93417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param value value of parameter
94417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
95417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
96417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void bind(int pos, int value) throws SQLite.Exception;
97417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
98417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
99417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Bind positional long value to compiled SQLite3 statement.
100417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
101417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param value value of parameter
102417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
103417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
104417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void bind(int pos, long value) throws SQLite.Exception;
105417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
106417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
107417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Bind positional double value to compiled SQLite3 statement.
108417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
109417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param value value of parameter
110417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
111417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
112417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void bind(int pos, double value) throws SQLite.Exception;
113417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
114417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
115417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Bind positional byte array to compiled SQLite3 statement.
116417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
117417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param value value of parameter, may be null
118417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
119417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
120417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void bind(int pos, byte[] value) throws SQLite.Exception;
121417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
122417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
123417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Bind positional String to compiled SQLite3 statement.
124417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
125417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param value value of parameter, may be null
126417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
127417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
128417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void bind(int pos, String value) throws SQLite.Exception;
129417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
130417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
131417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Bind positional SQL null to compiled SQLite3 statement.
132417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
133417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
134417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
135417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void bind(int pos) throws SQLite.Exception;
136417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
137417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
138417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Bind positional zero'ed blob to compiled SQLite3 statement.
139417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
140417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param length byte size of zero blob
141417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
142417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
143417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native void bind_zeroblob(int pos, int length)
1447a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLite.Exception;
145417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
146417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
147417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Return number of parameters in compiled SQLite3 statement.
148417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return int number of parameters
149417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
150417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
151417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native int bind_parameter_count() throws SQLite.Exception;
152417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
153417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
154417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Return name of parameter in compiled SQLite3 statement.
155417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param pos parameter index, 1-based
156417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return String parameter name
157417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
158417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
159417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native String bind_parameter_name(int pos) throws SQLite.Exception;
160417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
161417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
162417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Return index of named parameter in compiled SQLite3 statement.
163417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param name of parameter
164417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return int index of parameter, 1-based
165417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
166417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
167417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native int bind_parameter_index(String name)
1687a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	throws SQLite.Exception;
169417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
170417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
171417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
172417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve integer column from exec'ed SQLite3 statement.
173417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
174417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return int column value
175417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
176417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
177417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native int column_int(int col) throws SQLite.Exception;
178417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
179417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
180417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve long column from exec'ed SQLite3 statement.
181417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
182417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return long column value
183417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
184417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native long column_long(int col) throws SQLite.Exception;
185417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
186417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
187417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve double column from exec'ed SQLite3 statement.
188417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
189417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return double column value
190417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
191417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native double column_double(int col) throws SQLite.Exception;
192417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
193417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
194417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve blob column from exec'ed SQLite3 statement.
195417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
196417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return byte[] column value
197417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
198417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native byte[] column_bytes(int col) throws SQLite.Exception;
199417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
200417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
201417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve string column from exec'ed SQLite3 statement.
202417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
203417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return String column value
204417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
205417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native String column_string(int col) throws SQLite.Exception;
206417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
207417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
208417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve column type from exec'ed SQLite3 statement.
209417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
210417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return column type code, e.g. SQLite.Constants.SQLITE_INTEGER
211417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
212417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native int column_type(int col) throws SQLite.Exception;
213417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
214417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
215417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve number of columns of exec'ed SQLite3 statement.
216417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return int number of columns
217417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
218417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
219417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native int column_count() throws SQLite.Exception;
220417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
221417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
222417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Retrieve column data as object from exec'ed SQLite3 statement.
223417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
224417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return Object or null
225417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
226417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
227417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public Object column(int col) throws SQLite.Exception {
2285cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes	switch (column_type(col)) {
2297a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Constants.SQLITE_INTEGER:
2305cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes	    return Long.valueOf(column_long(col)); // android-changed: performance
2317a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Constants.SQLITE_FLOAT:
2327a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return new Double(column_double(col));
2337a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Constants.SQLITE_BLOB:
2347a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return column_bytes(col);
2357a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	case Constants.SQLITE3_TEXT:
2367a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	    return column_string(col);
2377a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	}
2387a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	return null;
239417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
240417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
241417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
242417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Return table name of column of SQLite3 statement.
243417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
244417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return String or null
245417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
246417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
247417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native String column_table_name(int col) throws SQLite.Exception;
248417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
249417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
250417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Return database name of column of SQLite3 statement.
251417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
252417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return String or null
253417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
254417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
255417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native String column_database_name(int col) throws SQLite.Exception;
256417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
257417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
258417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Return declared column type of SQLite3 statement.
259417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
260417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return String or null
261417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
262417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
263417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native String column_decltype(int col) throws SQLite.Exception;
264417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
265417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
266417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Return origin column name of column of SQLite3 statement.
267417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @param col column number, 0-based
268417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * @return String or null
269417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
270417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
271417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    public native String column_origin_name(int col) throws SQLite.Exception;
272417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
273417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
2745cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes     * Return statement status information.
2755cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes     * @param op which counter to report
2765cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes     * @param flg reset flag
2775cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes     * @return counter
2785cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes     */
2795cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes
2805cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes    public native int status(int op, boolean flg);
2815cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes
2825cd52ed8fd9244cbbb9c2553e58b511344f75d8bElliott Hughes    /**
283417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Destructor for object.
284417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
285417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
286417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    protected native void finalize();
287417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
288417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    /**
289417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     * Internal native initializer.
290417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes     */
291417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
292417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    private static native void internal_init();
293417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes
294417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    static {
2957a647e8547e57ca573541be55b3728ef7ce376feElliott Hughes	internal_init();
296417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes    }
297417deb1db112103aff04231b6ca79772ff7d3a21Elliott Hughes}
298