| 3860 | */ |
| 3861 | |
| 3862 | const char* get_one_variable(THD *thd, |
| 3863 | const SHOW_VAR *variable, |
| 3864 | enum_var_type value_type, SHOW_TYPE show_type, |
| 3865 | system_status_var *status_var, |
| 3866 | const CHARSET_INFO **charset, char *buff, |
| 3867 | size_t *length) |
| 3868 | { |
| 3869 | Any_pointer value, status_var_value; |
| 3870 | value.as_void= variable->value; |
| 3871 | status_var_value.as_system_status_var= status_var; |
| 3872 | const char *pos= buff; |
| 3873 | const char *end= buff; |
| 3874 | |
| 3875 | |
| 3876 | if (show_type == SHOW_SYS) |
| 3877 | { |
| 3878 | const sys_var *var= value.as_sys_var; |
| 3879 | show_type= var->show_type(); |
| 3880 | value.as_uchar= var->value_ptr(thd, value_type, &null_clex_str); |
| 3881 | *charset= var->charset(thd); |
| 3882 | } |
| 3883 | |
| 3884 | /* |
| 3885 | note that value may be == buff. All SHOW_xxx code below |
| 3886 | should still work in this case |
| 3887 | */ |
| 3888 | switch (show_type) { |
| 3889 | case SHOW_DOUBLE_STATUS: |
| 3890 | value.as_char= status_var_value.as_char + value.as_intptr; |
| 3891 | /* fall through */ |
| 3892 | case SHOW_DOUBLE: |
| 3893 | /* 6 is the default precision for '%f' in sprintf() */ |
| 3894 | end= buff + my_fcvt(*value.as_double, 6, buff, NULL); |
| 3895 | break; |
| 3896 | case SHOW_LONG_STATUS: |
| 3897 | value.as_char= status_var_value.as_char + value.as_intptr; |
| 3898 | /* fall through */ |
| 3899 | case SHOW_ULONG: |
| 3900 | case SHOW_LONG_NOFLUSH: // the difference lies in refresh_status() |
| 3901 | #ifndef _WIN64 |
| 3902 | case SHOW_SIZE_T: |
| 3903 | #endif |
| 3904 | end= int10_to_str(*value.as_long, buff, 10); |
| 3905 | break; |
| 3906 | case SHOW_LONGLONG_STATUS: |
| 3907 | value.as_char= status_var_value.as_char + value.as_intptr; |
| 3908 | /* fall through */ |
| 3909 | case SHOW_ULONGLONG: |
| 3910 | #ifdef _WIN64 |
| 3911 | case SHOW_SIZE_T: |
| 3912 | #endif |
| 3913 | end= longlong10_to_str(*value.as_longlong, buff, 10); |
| 3914 | break; |
| 3915 | case SHOW_HA_ROWS: |
| 3916 | end= longlong10_to_str((longlong) *value.as_ha_rows, buff, 10); |
| 3917 | break; |
| 3918 | case SHOW_BOOL: |
| 3919 | end= strmov(buff, *value.as_bool ? "ON" : "OFF"); |
no test coverage detected