Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sql/sql_prepare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ void Item_param::set_param_time(uchar **pos, ulong len)
tm.hour= (uint) to[5] + day * 24;
tm.minute= (uint) to[6];
tm.second= (uint) to[7];
tm.second_part= (length > 8) ? (ulong) sint4korr(to+8) : 0;
tm.second_part= (length >= 12) ? (ulong) sint4korr(to+8) : 0;
if (tm.hour > 838)
{
/* TODO: add warning 'Data truncated' here */
Expand Down Expand Up @@ -607,7 +607,7 @@ void Item_param::set_param_datetime(uchar **pos, ulong len)
tm.year= (uint) sint2korr(to);
tm.month= (uint) to[2];
tm.day= (uint) to[3];
if (length > 4)
if (length >= 7)
{
tm.hour= (uint) to[4];
tm.minute= (uint) to[5];
Expand All @@ -616,7 +616,7 @@ void Item_param::set_param_datetime(uchar **pos, ulong len)
else
tm.hour= tm.minute= tm.second= 0;

tm.second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
tm.second_part= (length >= 11) ? (ulong) sint4korr(to+7) : 0;
}
else
set_zero_time(&tm, MYSQL_TIMESTAMP_DATETIME);
Expand Down