| 414 | /* Assume that name && dl is already allocated */ |
| 415 | |
| 416 | static 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 |
no test coverage detected