60 static unsigned char escmask[32]=
62 0x01, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
68 char *from, *to, *end, *start;
69 String *arg= args[0]->val_str(str);
70 uint32_t arg_length, new_length;
74 str->copy(STRING_WITH_LEN(
"NULL"), collation.collation);
79 arg_length= arg->length();
80 new_length= arg_length+2;
82 for (from= (
char*) arg->ptr(), end= from + arg_length; from < end; from++)
83 new_length+= get_esc_bit(escmask, (
unsigned char) *from);
85 tmp_value.alloc(new_length);
90 to= (
char*) tmp_value.ptr() + new_length - 1;
92 for (start= (
char*) arg->ptr(),end= start + arg_length; end-- != start; to--)
118 tmp_value.length(new_length);
119 tmp_value.set_charset(collation.collation);