MXS-1216: Fix crash on MariaDB 10.0 DATETIME(n)

When a MariaDB 10.0 DATETIME field with a custom length was defined, the
field offsets weren't calculated properly.

As there is no metadata for pre-10.1 DATETIME types with decimal
precision, the metadata (i.e. decimal count) needs to be gathered from the
CREATE TABLE statement. This information is then used to calculate the
correct field length when the value is decoded.

This change does not fix the incorrect interpretation of the old DATETIME
value. The converted values are still garbled due to the fact that the
value needs to be shifted out of the decimal format before it can be
properly converted.
This commit is contained in:
Markus Mäkelä
2017-05-12 11:22:04 +03:00
parent 898bc3444e
commit 30bd869f1c
5 changed files with 128 additions and 52 deletions

View File

@ -98,6 +98,8 @@ typedef struct table_create
{
uint64_t columns;
char **column_names;
char **column_types;
int* column_lengths;
char *table;
char *database;
int version; /**< How many versions of this table have been used */