org.sqlite.udf
Class Function

java.lang.Object
  extended by org.sqlite.callback.Callback
      extended by org.sqlite.callback.NamedCallback
          extended by org.sqlite.udf.Function
Direct Known Subclasses:
AggregateFunction, ScalarFunction

public abstract class Function
extends NamedCallback

User-Defined function class.

See Also:
Create Or Redefine SQL Functions, JdbcConnection.createFunction(Function), JdbcConnection.dropFunction(Function), JdbcConnection.dropFunction(java.lang.String)

Field Summary
protected  int argc
          the number of arguments that the SQL function or aggregate takes
 
Constructor Summary
protected Function(java.lang.String name)
          invoke Function(String, -1) constructor.
protected Function(java.lang.String name, int argc)
          create Function object
 
Method Summary
 int getArgumentCount()
          Returns the number of arguments that the SQL function or aggregate takes.
protected abstract  void xFunc(Context ctx)
          Called from the sqlite3_step() function.
protected  void xFunc(long context, int argc, long value)
          Called from the sqlite3_step() function.
 
Methods inherited from class org.sqlite.callback.NamedCallback
getName
 
Methods inherited from class org.sqlite.callback.Callback
isRegistered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

argc

protected final int argc
the number of arguments that the SQL function or aggregate takes

Constructor Detail

Function

protected Function(java.lang.String name)
invoke Function(String, -1) constructor.

Parameters:
name - the function name

Function

protected Function(java.lang.String name,
                   int argc)
create Function object

Parameters:
name - the function name
argc - the number of arguments that the SQL function or aggregate takes.
Method Detail

getArgumentCount

public int getArgumentCount()
Returns the number of arguments that the SQL function or aggregate takes.

Returns:
the number of arguments that the SQL function or aggregate takes

xFunc

protected final void xFunc(long context,
                           int argc,
                           long value)
Called from the sqlite3_step() function.

Parameters:
context - the sqlite3_context* value
argc - the number of arguments
value - the sqlite3_value** value

xFunc

protected abstract void xFunc(Context ctx)
                       throws java.sql.SQLException
Called from the sqlite3_step() function.

Parameters:
ctx - sqlite3_context wrapper object
Throws:
java.sql.SQLException