MCPcopy Create free account
hub / github.com/MariaDB/server / add_udf

Function add_udf

sql/sql_udf.cc:416–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414/* Assume that name && dl is already allocated */
415
416static udf_func *add_udf(LEX_CSTRING *name, Item_result ret, const char *dl,
417 Item_udftype type)
418{
419 if (!name || !dl || !(uint) type || (uint) type > (uint) UDFTYPE_AGGREGATE)
420 return 0;
421 udf_func *tmp= (udf_func*) alloc_root(&mem, sizeof(udf_func));
422 if (!tmp)
423 return 0;
424 bzero((char*) tmp,sizeof(*tmp));
425 tmp->name = *name; //dup !!
426 tmp->dl = dl;
427 tmp->returns = ret;
428 tmp->type = type;
429 tmp->usage_count=1;
430 if (my_hash_insert(&udf_hash,(uchar*) tmp))
431 return 0;
432 using_udf_functions=1;
433 return tmp;
434}
435
436/**
437 Find record with the udf in the udf func table

Callers 2

udf_initFunction · 0.85
mysql_create_functionFunction · 0.85

Calls 2

alloc_rootFunction · 0.85
my_hash_insertFunction · 0.85

Tested by

no test coverage detected