24 #include <drizzled/lex_string.h>
30 static uint32_t get_esc_bit(
unsigned char *mask,
unsigned char num)
32 return (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7));
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;
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);
String * val_str(String *)
Returns the argument string in single quotes suitable for using in a SQL statement.
virtual String * val_str(String *str)=0