diff options
author | unknown <bell@sanja.is.com.ua> | 2003-09-13 17:47:59 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-09-13 17:47:59 +0300 |
commit | 07e372cd6b3a89d301fc44b5359fac01e285aa76 (patch) | |
tree | a3c9c07d2cdb16d8472b0fd27ea2edbe9f55cfe3 /sql/item_func.cc | |
parent | 55e776d14565ea6ee9841612069c24f6b8a3023c (diff) | |
download | mariadb-git-07e372cd6b3a89d301fc44b5359fac01e285aa76.tar.gz |
new UDF arguments interface (WL#1017) (SCRUM)
include/mysql_com.h:
new UDF arguments interface
sql/item.cc:
added lenghth name foe item (to avoid strlen() call)
sql/item.h:
added lenghth name foe item (to avoid strlen() call)
sql/item_func.cc:
new UDF arguments
sql/sql_parse.cc:
fixed problem with UDF in 5.0
sql/sql_yacc.yy:
new syntax of UDF arguments
sql/udf_example.cc:
new UDF example (stupid function to test parameters)
tests/udf_test.res:
new UDF example (stupid function to test parameters)
tests/udf_test:
new UDF example (stupid function to test parameters)
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 8bac8fb6e07..c8307f30a0b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1498,11 +1498,16 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, const_item_cache&=item->const_item(); f_args.arg_type[i]=item->result_type(); } + //TODO: why all folowing memory is not allocated with 1 call of sql_alloc? if (!(buffers=new String[arg_count]) || !(f_args.args= (char**) sql_alloc(arg_count * sizeof(char *))) || - !(f_args.lengths=(ulong*) sql_alloc(arg_count * sizeof(long))) || - !(f_args.maybe_null=(char*) sql_alloc(arg_count * sizeof(char))) || - !(num_buffer= (char*) sql_alloc(ALIGN_SIZE(sizeof(double))*arg_count))) + !(f_args.lengths= (ulong*) sql_alloc(arg_count * sizeof(long))) || + !(f_args.maybe_null= (char*) sql_alloc(arg_count * sizeof(char))) || + !(num_buffer= (char*) sql_alloc(arg_count * + ALIGN_SIZE(sizeof(double)))) || + !(f_args.attributes= (char**) sql_alloc(arg_count * sizeof(char *))) || + !(f_args.attribute_lengths= (ulong*) sql_alloc(arg_count * + sizeof(long)))) { free_udf(u_d); DBUG_RETURN(1); @@ -1521,8 +1526,10 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, for (uint i=0; i < arg_count; i++) { f_args.args[i]=0; - f_args.lengths[i]=arguments[i]->max_length; - f_args.maybe_null[i]=(char) arguments[i]->maybe_null; + f_args.lengths[i]= arguments[i]->max_length; + f_args.maybe_null[i]= (char) arguments[i]->maybe_null; + f_args.attributes[i]= arguments[i]->name; + f_args.attribute_lengths[i]= arguments[i]->name_length; switch(arguments[i]->type()) { case Item::STRING_ITEM: // Constant string ! |