MXS-2354: Fix subsecond part of temporal values

TIMESTAMP2, DATETIME2 and TIME2 values with decimal parts are now
correctly converted into their string forms. Previously the decimal part
was ignored but most of the code required to extract it was in place.
This commit is contained in:
Markus Mäkelä
2019-09-26 10:31:22 +03:00
parent 72d9e41ccb
commit 27675ed41d
3 changed files with 113 additions and 85 deletions

View File

@ -85,7 +85,8 @@ bool column_is_decimal(uint8_t type);
bool fixed_string_is_enum(uint8_t type);
/** Value unpacking */
size_t unpack_temporal_value(uint8_t type, uint8_t* ptr, uint8_t* metadata, int length, struct tm* tm);
size_t unpack_temporal_value(uint8_t type, uint8_t* ptr, uint8_t* metadata,
int length, char* buf, size_t buflen);
size_t unpack_enum(uint8_t* ptr, uint8_t* metadata, uint8_t* dest);
size_t unpack_numeric_field(uint8_t* ptr, uint8_t type, uint8_t* metadata, uint8_t* val);
size_t unpack_bit(uint8_t* ptr,
@ -96,6 +97,4 @@ size_t unpack_bit(uint8_t* ptr,
uint64_t* dest);
size_t unpack_decimal_field(uint8_t* ptr, uint8_t* metadata, double* val_float);
void format_temporal_value(char* str, size_t size, uint8_t type, struct tm* tm);
MXS_END_DECLS