MySQL 8.4.3
Source Code Documentation
sql_udf.h File Reference
#include <stddef.h>
#include <sys/types.h>
#include "lex_string.h"
#include "my_inttypes.h"
#include "my_table_map.h"
#include "mysql/udf_registration_types.h"

Go to the source code of this file.

Classes

struct  udf_func
 
struct  Udf_args_extension
 
struct  Udf_return_value_extension
 
class  udf_handler
 

Typedefs

typedef void udf_hash_for_each_func_t(udf_func *, void *)
 

Functions

void udf_init_globals ()
 Initialize the UDF global structures. More...
 
void udf_read_functions_table ()
 
void udf_unload_udfs ()
 Deinitialize the UDF subsystem. More...
 
void udf_deinit_globals ()
 Deinitialize the UDF subsystem. More...
 
udf_funcfind_udf (const char *name, size_t len=0, bool mark_used=false)
 
void free_udf (udf_func *udf)
 
bool mysql_create_function (THD *thd, udf_func *udf, bool if_not_exists)
 Create a user defined function. More...
 
bool mysql_drop_function (THD *thd, const LEX_STRING *name)
 Drop a user defined function. More...
 
ulong udf_hash_size (void)
 
void udf_hash_rlock (void)
 
void udf_hash_unlock (void)
 
void udf_hash_for_each (udf_hash_for_each_func_t *func, void *arg)
 

Typedef Documentation

◆ udf_hash_for_each_func_t

typedef void udf_hash_for_each_func_t(udf_func *, void *)

Function Documentation

◆ find_udf()

udf_func * find_udf ( const char *  name,
size_t  len = 0,
bool  mark_used = false 
)

◆ free_udf()

void free_udf ( udf_func udf)

◆ mysql_create_function()

bool mysql_create_function ( THD thd,
udf_func udf,
bool  if_not_exists 
)

Create a user defined function.

Atomicity: The operation to create a user defined function is atomic/crash-safe. Changes to the Data-dictionary and writing event to binlog are part of the same transaction. All the changes are done as part of the same transaction or do not have any side effects on the operation failure. UDF hash is in sync with operation state. UDF hash do not contain any stale/incorrect data in case of failure. In case of crash, there won't be any discrepancy between the data-dictionary table and the binary log.

Parameters
thdTHD context.
udfPointer to UDF function.
if_not_existsTrue if 'IF NOT EXISTS' clause was specified.
Note
Like implementations of other DDL/DML in MySQL, this function relies on the caller to close the thread tables. This is done in the end of dispatch_command().

◆ mysql_drop_function()

bool mysql_drop_function ( THD thd,
const LEX_STRING udf_name 
)

Drop a user defined function.

Atomicity: The operation to drop a user defined function is atomic/crash-safe. Changes to the Data-dictionary and writing event to binlog are part of the same transaction. All the changes are done as part of the same transaction or do not have any side effects on the operation failure. UDF hash is in sync with operation state. UDF hash do not contain any stale/incorrect data in case of failure. In case of crash, there won't be any discrepancy between the data-dictionary table and the binary log.

Parameters
thdTHD context.
udf_nameName of the UDF function.

◆ udf_deinit_globals()

void udf_deinit_globals ( )

Deinitialize the UDF subsystem.

This function does the following:

  1. Free the UDF hash.
  2. Free the memroot allocated.
  3. Destroy the RW mutex object.

◆ udf_hash_for_each()

void udf_hash_for_each ( udf_hash_for_each_func_t func,
void *  arg 
)

◆ udf_hash_rlock()

void udf_hash_rlock ( void  )

◆ udf_hash_size()

ulong udf_hash_size ( void  )

◆ udf_hash_unlock()

void udf_hash_unlock ( void  )

◆ udf_init_globals()

void udf_init_globals ( )

Initialize the UDF global structures.

This is done as a separate step so that the UDF registration service can work when initializing plugins, which happens before reading the UDF table.

◆ udf_read_functions_table()

void udf_read_functions_table ( )

◆ udf_unload_udfs()

void udf_unload_udfs ( )

Deinitialize the UDF subsystem.

This function closes the shared libraries.