Function (SQLite Java Wrapper)
Keywords: SQLite.Function interface

Overview | Package | Class | Tree
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## SQLite
Interface Function

public interface Function

Callback interface for SQLite's user defined functions. Each callback method receives a FunctionContext object which is used to set the function result or error code.
Example:

       class SinFunc implements SQLite.Function {
         public void function(SQLite.FunctionContext fc, String args[]) {
           try {
             Double d = new Double(args[0]);
             fc.set_result(Math.sin(d.doubleValue()));
           } catch (Exception e) {
             fc.set_error("sin(" + args[0] + "):" + e);
           }
         }
         ...
       }
       SQLite.Database db = new SQLite.Database();
       db.open("db", 0);
       db.create_function("sin", 1, SinFunc);
       ...
       db.exec("select sin(1.0) from test", null);

Method Summary
`void` | `function(FunctionContext fc, String[] args)` Callback for regular function.
`void` | `last_step(FunctionContext fc)` Callback for final step in aggregate function.
`void` | `step(FunctionContext fc, String[] args)` Callback for one step in aggregate function.

Method Detail

### function

    public void function(FunctionContext fc,
                         String[] args)

  Callback for regular function.

  Parameters:
    `fc` - function's context for reporting result
    `args` - String array of arguments

### last_step

    public void last_step(FunctionContext fc)

  Callback for final step in aggregate function.

  Parameters:
    `fc` - function's context for reporting result

### step

    public void step(FunctionContext fc,
                     String[] args)

  Callback for one step in aggregate function.

  Parameters:
    `fc` - function's context for reporting result
    `args` - String array of arguments

Overview | Package | Class | Tree
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Contact: Christian Werner