org.sqlite.udf
Class AggregateFunction<T>

java.lang.Object
  extended by org.sqlite.callback.Callback
      extended by org.sqlite.callback.NamedCallback
          extended by org.sqlite.udf.Function
              extended by org.sqlite.udf.AggregateFunction<T>

public abstract class AggregateFunction<T>
extends Function

User-Defined aggregate function class.

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

Field Summary
protected  java.lang.ThreadLocal<T> tls
          thread local storage
 
Fields inherited from class org.sqlite.udf.Function
argc
 
Constructor Summary
AggregateFunction(java.lang.String name)
          create aggregate function object.
AggregateFunction(java.lang.String name, int argc)
          create aggregate function object.
AggregateFunction(java.lang.String name, int argc, int enc)
          create aggregate function object.
 
Method Summary
protected  T get()
          Returns the value in the current thread's copy of this thread-local variable.
protected abstract  T initialValue()
          Returns the current thread's "initial value" for this thread-local variable.
protected  void remove()
          Removes the current thread's value for this thread-local variable.
protected  void set(T value)
          Sets the current thread's copy of this thread-local variable to the specified value.
protected abstract  void xFinal(Context ctx)
           
protected  void xFinal(long context)
          Called from the sqlite3_step() function.
protected  void xFunc(Context ctx)
          invoke xStep() method.
protected abstract  void xStep(Context ctx)
           
 
Methods inherited from class org.sqlite.udf.Function
getArgumentCount, register, unregister, xFunc
 
Methods inherited from class org.sqlite.callback.NamedCallback
getEncoding, getName
 
Methods inherited from class org.sqlite.callback.Callback
delete, isRegistered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tls

protected final java.lang.ThreadLocal<T> tls
thread local storage

Constructor Detail

AggregateFunction

public AggregateFunction(java.lang.String name)
create aggregate function object.

Parameters:
name - the function name
See Also:
Function.Function(java.lang.String)

AggregateFunction

public AggregateFunction(java.lang.String name,
                         int argc)
create aggregate function object.

Parameters:
name - the function name
argc - the number of arguments that the aggregate takes.
See Also:
Function.Function(java.lang.String, int)

AggregateFunction

public AggregateFunction(java.lang.String name,
                         int argc,
                         int enc)
create aggregate function object.

Parameters:
name - the function name
argc - the number of arguments that the aggregate takes.
enc - the specifies what text encoding this function prefers for its parameters
See Also:
Text Encodings, Function.Function(java.lang.String, int, int)
Method Detail

xFunc

protected final void xFunc(Context ctx)
                    throws java.sql.SQLException
invoke xStep() method.

Specified by:
xFunc in class Function
Parameters:
ctx - sqlite3_context wrapper object
Throws:
java.sql.SQLException
See Also:
xStep(org.sqlite.udf.Context)

xFinal

protected final void xFinal(long context)
Called from the sqlite3_step() function.

Parameters:
context -
See Also:
xFinal(org.sqlite.udf.Context)

initialValue

protected abstract T initialValue()
Returns the current thread's "initial value" for this thread-local variable.

Returns:
the initial value for this thread-local
See Also:
ThreadLocal.initialValue()

get

protected T get()
Returns the value in the current thread's copy of this thread-local variable.

Returns:
the current thread's value of this thread-local
See Also:
ThreadLocal.get()

remove

protected void remove()
Removes the current thread's value for this thread-local variable.

See Also:
ThreadLocal.remove()

set

protected void set(T value)
Sets the current thread's copy of this thread-local variable to the specified value.

Parameters:
value - the value to be stored in the current thread's copy of this thread-local.
See Also:
ThreadLocal.set(Object)

xStep

protected abstract void xStep(Context ctx)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

xFinal

protected abstract void xFinal(Context ctx)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException