| 950 | */ |
| 951 | |
| 952 | DATE_TIME_FORMAT *date_time_format_copy(THD *thd, DATE_TIME_FORMAT *format) |
| 953 | { |
| 954 | DATE_TIME_FORMAT *new_format; |
| 955 | ulong length= sizeof(*format) + format->format.length + 1; |
| 956 | |
| 957 | if (thd) |
| 958 | new_format= (DATE_TIME_FORMAT *) thd->alloc(length); |
| 959 | else |
| 960 | new_format= (DATE_TIME_FORMAT *) my_malloc(length, MYF(MY_WME)); |
| 961 | if (new_format) |
| 962 | { |
| 963 | /* Put format string after current pos */ |
| 964 | new_format->format.str= (char*) (new_format+1); |
| 965 | memcpy((char*) new_format->positions, (char*) format->positions, |
| 966 | sizeof(format->positions)); |
| 967 | new_format->time_separator= format->time_separator; |
| 968 | /* We make the string null terminated for easy printf in SHOW VARIABLES */ |
| 969 | memcpy((char*) new_format->format.str, format->format.str, |
| 970 | format->format.length); |
| 971 | new_format->format.str[format->format.length]= 0; |
| 972 | new_format->format.length= format->format.length; |
| 973 | } |
| 974 | return new_format; |
| 975 | } |
| 976 | |
| 977 | |
| 978 | KNOWN_DATE_TIME_FORMAT known_date_time_formats[6]= |
no test coverage detected