SQLiteDatabase.SetCustomAggregateFunction(String, IBinaryOperator) Method

Definition

Register a custom aggregate function that can be called from SQL expressions.

[Android.Runtime.Register("setCustomAggregateFunction", "(Ljava/lang/String;Ljava/util/function/BinaryOperator;)V", "GetSetCustomAggregateFunction_Ljava_lang_String_Ljava_util_function_BinaryOperator_Handler", ApiSince=30)]
public virtual void SetCustomAggregateFunction (string functionName, Java.Util.Functions.IBinaryOperator aggregateFunction);
[<Android.Runtime.Register("setCustomAggregateFunction", "(Ljava/lang/String;Ljava/util/function/BinaryOperator;)V", "GetSetCustomAggregateFunction_Ljava_lang_String_Ljava_util_function_BinaryOperator_Handler", ApiSince=30)>]
abstract member SetCustomAggregateFunction : string * Java.Util.Functions.IBinaryOperator -> unit
override this.SetCustomAggregateFunction : string * Java.Util.Functions.IBinaryOperator -> unit

Parameters

functionName
String

Case-insensitive name to register this function under, limited to 255 UTF-8 bytes in length.

aggregateFunction
IBinaryOperator

Functional interface that will be invoked when the function name is used by a SQL statement. The argument values from the SQL statement are passed to the functional interface, and the return values from the functional interface are returned back into the SQL statement.

Attributes

Remarks

Register a custom aggregate function that can be called from SQL expressions.

For example, registering a custom aggregation function named LONGEST could be used in a query like SELECT LONGEST(name) FROM employees.

The implementation of this method follows the reduction flow outlined in java.util.stream.Stream#reduce(BinaryOperator), and the custom aggregation function is expected to be an associative accumulation function, as defined by that class.

When attempting to register multiple functions with the same function name, SQLite will replace any previously defined functions with the latest definition, regardless of what function type they are. SQLite does not support unregistering functions.

Java documentation for android.database.sqlite.SQLiteDatabase.setCustomAggregateFunction(java.lang.String, java.util.function.BinaryOperator<java.lang.String>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to