summaryrefslogtreecommitdiff
path: root/sql/my_decimal.cc
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@deer.(none)>2006-11-08 19:09:39 +0400
committerunknown <holyfoot/hf@deer.(none)>2006-11-08 19:09:39 +0400
commit90d14d50a99508a4ac459f510eb717d596976da2 (patch)
tree533737794921f247b2bb1a19b363f96a1c6b22c6 /sql/my_decimal.cc
parent7b126a91c00d7c2bca321da0de13f47220da1972 (diff)
parent3e0139d95750aa79d96f185c81aebd375fdc571e (diff)
downloadmariadb-git-90d14d50a99508a4ac459f510eb717d596976da2.tar.gz
Merge mysql.com:/home/hf/work/mysql-5.0.clean
into mysql.com:/home/hf/work/mysql-5.1.clean include/my_time.h: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/gis-rtree.result: Auto merged mysql-test/r/order_by.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/type_datetime.result: Auto merged mysql-test/r/udf.result: Auto merged mysql-test/t/func_group.test: Auto merged mysql-test/t/gis-rtree.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/udf.test: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/filesort.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_subselect.h: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/my_decimal.cc: Auto merged sql/my_decimal.h: Auto merged sql/mysql_priv.h: Auto merged sql/records.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql-common/my_time.c: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged mysql-test/r/type_newdecimal.result: SCCS merged mysql-test/t/type_newdecimal.test: merging sql/item.cc: merging sql/item_subselect.cc: SCCS merged sql/item_timefunc.h: merging sql/sql_lex.cc: SCCS merged sql/sql_select.h: merging
Diffstat (limited to 'sql/my_decimal.cc')
-rw-r--r--sql/my_decimal.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 89607129026..30a271df064 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
+#include <time.h>
+
#ifndef MYSQL_CLIENT
/*
@@ -190,6 +192,23 @@ int str2my_decimal(uint mask, const char *from, uint length,
}
+my_decimal *date2my_decimal(TIME *ltime, my_decimal *dec)
+{
+ longlong date;
+ date = (ltime->year*100L + ltime->month)*100L + ltime->day;
+ if (ltime->time_type > MYSQL_TIMESTAMP_DATE)
+ date= ((date*100L + ltime->hour)*100L+ ltime->minute)*100L + ltime->second;
+ if (int2my_decimal(E_DEC_FATAL_ERROR, date, FALSE, dec))
+ return dec;
+ if (ltime->second_part)
+ {
+ dec->buf[(dec->intg-1) / 9 + 1]= ltime->second_part * 1000;
+ dec->frac= 6;
+ }
+ return dec;
+}
+
+
#ifndef DBUG_OFF
/* routines for debugging print */