66 uint32_t length,tot_length;
69 int64_t count= args[1]->val_int();
70 String *res= args[0]->val_str(str);
76 if (count <= 0 && (count == 0 || !args[1]->unsigned_flag))
77 return &my_empty_string;
81 if ((uint64_t) count > INT32_MAX)
87 if (length > session.variables.max_allowed_packet / (uint) count)
89 push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
90 ER_WARN_ALLOWED_PACKET_OVERFLOWED,
91 ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
92 func_name(), session.variables.max_allowed_packet);
95 tot_length= length*(uint) count;
96 if (!(res= alloc_buffer(res,str,&tmp_value,tot_length)))
99 to=(
char*) res->ptr()+length;
102 memcpy(to,res->ptr(),length);