Partager via


SQLiteDatabase.SetCustomScalarFunction(String, IUnaryOperator) Method

Definition

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

[Android.Runtime.Register("setCustomScalarFunction", "(Ljava/lang/String;Ljava/util/function/UnaryOperator;)V", "GetSetCustomScalarFunction_Ljava_lang_String_Ljava_util_function_UnaryOperator_Handler", ApiSince=30)]
public virtual void SetCustomScalarFunction (string functionName, Java.Util.Functions.IUnaryOperator scalarFunction);
[<Android.Runtime.Register("setCustomScalarFunction", "(Ljava/lang/String;Ljava/util/function/UnaryOperator;)V", "GetSetCustomScalarFunction_Ljava_lang_String_Ljava_util_function_UnaryOperator_Handler", ApiSince=30)>]
abstract member SetCustomScalarFunction : string * Java.Util.Functions.IUnaryOperator -> unit
override this.SetCustomScalarFunction : string * Java.Util.Functions.IUnaryOperator -> unit

Parameters

functionName
String

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

scalarFunction
IUnaryOperator

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 scalar function that can be called from SQL expressions.

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

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.setCustomScalarFunction(java.lang.String, java.util.function.UnaryOperator<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