summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-05-31 13:25:11 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-05-31 13:25:11 +0400
commit89b83c05e0946e0fdd7cf9392a5e5b7e7a78957e (patch)
treefe89d7122a6e41e82ab872980dc52799becb5ed3 /sql/field.cc
parent9731b3852b0be5820fc795cf4f27d0f260ebe761 (diff)
downloadmariadb-git-89b83c05e0946e0fdd7cf9392a5e5b7e7a78957e.tar.gz
Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
Field_time::get_date method does not initialize MYSQL_TIME::time_type field. The fix is to init this field. mysql-test/r/type_time.result: test case mysql-test/t/type_time.test: test case sql/field.cc: --use Field_time::get_time in Field_time::get_date --removed duplicated code in Field_time::get_date method
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc15
1 files changed, 1 insertions, 14 deletions
diff --git a/sql/field.cc b/sql/field.cc
index b203a42a918..7360a013ffb 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5312,7 +5312,6 @@ String *Field_time::val_str(String *val_buffer,
bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
{
- long tmp;
THD *thd= table ? table->in_use : current_thd;
if (!(fuzzydate & TIME_FUZZY_DATE))
{
@@ -5322,19 +5321,7 @@ bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
thd->row_count);
return 1;
}
- tmp=(long) sint3korr(ptr);
- ltime->neg=0;
- if (tmp < 0)
- {
- ltime->neg= 1;
- tmp=-tmp;
- }
- ltime->hour=tmp/10000;
- tmp-=ltime->hour*10000;
- ltime->minute= tmp/100;
- ltime->second= tmp % 100;
- ltime->year= ltime->month= ltime->day= ltime->second_part= 0;
- return 0;
+ return Field_time::get_time(ltime);
}