1 package SQLite; 2 3 /** 4 * Context for execution of SQLite's user defined functions. 5 * A reference to an instance of this class is passed to 6 * user defined functions. 7 */ 8 9 public class FunctionContext { 10 11 /** 12 * Internal handle for the native SQLite API. 13 */ 14 15 private long handle = 0; 16 17 /** 18 * Set function result from string. 19 * 20 * @param r result string 21 */ 22 23 public native void set_result(String r); 24 25 /** 26 * Set function result from integer. 27 * 28 * @param r result integer 29 */ 30 31 public native void set_result(int r); 32 33 /** 34 * Set function result from double. 35 * 36 * @param r result double 37 */ 38 39 public native void set_result(double r); 40 41 /** 42 * Set function result from error message. 43 * 44 * @param r result string (error message) 45 */ 46 47 public native void set_error(String r); 48 49 /** 50 * Set function result from byte array. 51 * Only provided by SQLite3 databases. 52 * 53 * @param r result byte array 54 */ 55 56 public native void set_result(byte[] r); 57 58 /** 59 * Set function result as empty blob given size. 60 * Only provided by SQLite3 databases. 61 * 62 * @param n size for empty blob 63 */ 64 65 public native void set_result_zeroblob(int n); 66 67 /** 68 * Retrieve number of rows for aggregate function. 69 */ 70 71 public native int count(); 72 73 /** 74 * Internal native initializer. 75 */ 76 77 private static native void internal_init(); 78 79 static { 80 internal_init(); 81 } 82 } 83