MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / get_arguments

Method get_arguments

sql/item_func.cc:737–786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735#ifdef HAVE_DLOPEN
736
737bool udf_handler::get_arguments()
738{
739 if (error)
740 return 1; // Got an error earlier
741 char *to= num_buffer;
742 uint str_count=0;
743 for (uint i=0; i < f_args.arg_count; i++)
744 {
745 f_args.args[i]=0;
746 switch (f_args.arg_type[i]) {
747 case STRING_RESULT:
748 case DECIMAL_RESULT:
749 {
750 String *res=args[i]->val_str(&buffers[str_count++]);
751 if (!(args[i]->null_value))
752 {
753 f_args.args[i]= (char*) res->ptr();
754 f_args.lengths[i]= res->length();
755 }
756 else
757 {
758 f_args.lengths[i]= 0;
759 }
760 break;
761 }
762 case INT_RESULT:
763 *((longlong*) to) = args[i]->val_int();
764 if (!args[i]->null_value)
765 {
766 f_args.args[i]=to;
767 to+= ALIGN_SIZE(sizeof(longlong));
768 }
769 break;
770 case REAL_RESULT:
771 *((double*) to)= args[i]->val_real();
772 if (!args[i]->null_value)
773 {
774 f_args.args[i]=to;
775 to+= ALIGN_SIZE(sizeof(double));
776 }
777 break;
778 case ROW_RESULT:
779 default:
780 // This case should never be chosen
781 DBUG_ASSERT(0);
782 break;
783 }
784 }
785 return 0;
786}
787
788/**
789 @return

Callers

nothing calls this directly

Calls 5

val_strMethod · 0.45
ptrMethod · 0.45
lengthMethod · 0.45
val_intMethod · 0.45
val_realMethod · 0.45

Tested by

no test coverage detected