• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package SQLite;
2 
3 /**
4  * Callback interface for SQLite's query results.
5  * <BR><BR>
6  * Example:<BR>
7  *
8  * <PRE>
9  *   class TableFmt implements SQLite.Callback {
10  *     public void columns(String cols[]) {
11  *       System.out.println("&lt;TH&gt;&lt;TR&gt;");
12  *       for (int i = 0; i &lt; cols.length; i++) {
13  *         System.out.println("&lt;TD&gt;" + cols[i] + "&lt;/TD&gt;");
14  *       }
15  *       System.out.println("&lt;/TR&gt;&lt;/TH&gt;");
16  *     }
17  *     public boolean newrow(String cols[]) {
18  *       System.out.println("&lt;TR&gt;");
19  *       for (int i = 0; i &lt; cols.length; i++) {
20  *         System.out.println("&lt;TD&gt;" + cols[i] + "&lt;/TD&gt;");
21  *       }
22  *       System.out.println("&lt;/TR&gt;");
23  *       return false;
24  *     }
25  *   }
26  *   ...
27  *   SQLite.Database db = new SQLite.Database();
28  *   db.open("db", 0);
29  *   System.out.println("&lt;TABLE&gt;");
30  *   db.exec("select * from TEST", new TableFmt());
31  *   System.out.println("&lt;/TABLE&gt;");
32  *   ...
33  * </PRE>
34  */
35 
36 public interface Callback {
37 
38     /**
39      * Reports column names of the query result.
40      * This method is invoked first (and once) when
41      * the SQLite engine returns the result set.<BR><BR>
42      *
43      * @param coldata string array holding the column names
44      */
45 
columns(String coldata[])46     public void columns(String coldata[]);
47 
48     /**
49      * Reports type names of the columns of the query result.
50      * This is available from SQLite 2.6.0 on and needs
51      * the PRAGMA show_datatypes to be turned on.<BR><BR>
52      *
53      * @param types string array holding column types
54      */
55 
types(String types[])56     public void types(String types[]);
57 
58     /**
59      * Reports row data of the query result.
60      * This method is invoked for each row of the
61      * result set. If true is returned the running
62      * SQLite query is aborted.<BR><BR>
63      *
64      * @param rowdata string array holding the column values of the row
65      */
66 
newrow(String rowdata[])67     public boolean newrow(String rowdata[]);
68 }
69