| 172 | } |
| 173 | |
| 174 | bool sys_var::update(THD *thd, set_var *var) |
| 175 | { |
| 176 | enum_var_type type= var->type; |
| 177 | if (type == OPT_GLOBAL || scope() == GLOBAL) |
| 178 | { |
| 179 | /* |
| 180 | Yes, both locks need to be taken before an update, just as |
| 181 | both are taken to get a value. If we'll take only 'guard' here, |
| 182 | then value_ptr() for strings won't be safe in SHOW VARIABLES anymore, |
| 183 | to make it safe we'll need value_ptr_unlock(). |
| 184 | */ |
| 185 | AutoWLock lock1(&PLock_global_system_variables); |
| 186 | AutoWLock lock2(guard); |
| 187 | return global_update(thd, var) || |
| 188 | (on_update && on_update(this, thd, OPT_GLOBAL)); |
| 189 | } |
| 190 | else |
| 191 | return session_update(thd, var) || |
| 192 | (on_update && on_update(this, thd, OPT_SESSION)); |
| 193 | } |
| 194 | |
| 195 | uchar *sys_var::session_value_ptr(THD *thd, LEX_STRING *base) |
| 196 | { |
nothing calls this directly
no test coverage detected