Skip to content

Commit

Permalink
Fix for MDEV-10173: Ignore decimals if the value exceeds the type
Browse files Browse the repository at this point in the history
specifc maximum of 6 digits
  • Loading branch information
9EOR9 committed Jun 3, 2016
1 parent 3192cd4 commit 392dc4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libmariadb/ma_stmt_codec.c
Expand Up @@ -864,7 +864,7 @@ void ps_fetch_datetime(MYSQL_BIND *r_param, const MYSQL_FIELD * field,
break;
case MYSQL_TYPE_TIME:
length= sprintf(dtbuffer, "%s%02u:%02u:%02u", (tm.neg ? "-" : ""), tm.hour, tm.minute, tm.second);
if (field->decimals)
if (field->decimals && field->decimals <= 6)
{
char ms[8];
sprintf(ms, ".%06u", tm.second_part);
Expand All @@ -877,7 +877,7 @@ void ps_fetch_datetime(MYSQL_BIND *r_param, const MYSQL_FIELD * field,
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
length= sprintf(dtbuffer, "%04u-%02u-%02u %02u:%02u:%02u", tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
if (field->decimals)
if (field->decimals && field->decimals <= 6)
{
char ms[8];
sprintf(ms, ".%06u", tm.second_part);
Expand Down

0 comments on commit 392dc4d

Please sign in to comment.