For the items which don't have its own fast val_str_ascii() implementation we provide a generic slower version, which converts from the Item character set to ASCII. For better performance conversion happens only in case of a "tricky" Item character set (e.g. UCS2). Normally conversion does not happen. */
| 97 | Normally conversion does not happen. |
| 98 | */ |
| 99 | String *Item::val_str_ascii(String *str) |
| 100 | { |
| 101 | if (!(collation.collation->state & MY_CS_NONASCII)) |
| 102 | return val_str(str); |
| 103 | |
| 104 | DBUG_ASSERT(str != &str_value); |
| 105 | |
| 106 | uint errors; |
| 107 | String *res= val_str(&str_value); |
| 108 | if (!res) |
| 109 | return 0; |
| 110 | |
| 111 | if ((null_value= str->copy(res->ptr(), res->length(), |
| 112 | collation.collation, &my_charset_latin1, |
| 113 | &errors))) |
| 114 | return 0; |
| 115 | |
| 116 | return str; |
| 117 | } |
| 118 | |
| 119 | |
| 120 | String *Item::val_string_from_real(String *str) |