| 235 | completion_type_names, DEFAULT(0)); |
| 236 | |
| 237 | static bool check_collation_not_null(sys_var *self, THD *thd, set_var *var) |
| 238 | { |
| 239 | if (!var->value) |
| 240 | return false; |
| 241 | |
| 242 | char buff[STRING_BUFFER_USUAL_SIZE]; |
| 243 | if (var->value->result_type() == STRING_RESULT) |
| 244 | { |
| 245 | String str(buff, sizeof(buff), system_charset_info), *res; |
| 246 | if (!(res= var->value->val_str(&str))) |
| 247 | var->save_result.ptr= NULL; |
| 248 | else |
| 249 | { |
| 250 | ErrConvString err(res); /* Get utf8 '\0'-terminated string */ |
| 251 | if (!(var->save_result.ptr= get_charset_by_name(err.ptr(), MYF(0)))) |
| 252 | { |
| 253 | my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr()); |
| 254 | return true; |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | else // INT_RESULT |
| 259 | { |
| 260 | int csno= (int)var->value->val_int(); |
| 261 | if (!(var->save_result.ptr= get_charset(csno, MYF(0)))) |
| 262 | { |
| 263 | my_error(ER_UNKNOWN_COLLATION, MYF(0), llstr(csno, buff)); |
| 264 | return true; |
| 265 | } |
| 266 | } |
| 267 | return check_not_null(self, thd, var); |
| 268 | } |
| 269 | static Sys_var_struct Sys_collation_connection( |
| 270 | "collation_connection", "The collation of the connection " |
| 271 | "character set", |
no test coverage detected