summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-06-09 03:22:55 +0400
committerunknown <konstantin@mysql.com>2004-06-09 03:22:55 +0400
commit19a5cf935a5395879671813978fef9556241ddfb (patch)
tree51214e2ab4463a9a6aad32b9685ae517a7dfd065 /sql/sql_prepare.cc
parentee401045be84b32ef930092ede1974117cde4b85 (diff)
parent27eda71204700eb6953205baf47d9cbeb4d367c1 (diff)
downloadmariadb-git-19a5cf935a5395879671813978fef9556241ddfb.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/kostja/mysql/mysql-4.1-4026 sql/item.cc: Auto merged sql/item.h: Auto merged sql/sql_prepare.cc: Auto merged
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 554233a9854..40107ebc637 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -339,20 +339,19 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len)
{
uchar *to= *pos;
TIME tm;
-
- /* TODO: why length is compared with 8 here? */
- tm.second_part= (length > 8 ) ? (ulong) sint4korr(to+7): 0;
+ tm.neg= (bool) to[0];
+ day= (uint) sint4korr(to+1);
/*
Note, that though ranges of hour, minute and second are not checked
here we rely on them being < 256: otherwise
we'll get buffer overflow in make_{date,time} functions,
which are called when time value is converted to string.
*/
- day= (uint) sint4korr(to+1);
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;
if (tm.hour > 838)
{
/* TODO: add warning 'Data truncated' here */
@@ -361,7 +360,6 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len)
tm.second= 59;
}
tm.day= tm.year= tm.month= 0;
- tm.neg= (bool)to[0];
param->set_time(&tm, TIMESTAMP_TIME,
MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
@@ -372,14 +370,16 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len)
static void set_param_datetime(Item_param *param, uchar **pos, ulong len)
{
uint length;
-
+
if ((length= get_param_length(pos, len)) >= 4)
{
uchar *to= *pos;
TIME tm;
-
- tm.second_part= (length > 7 ) ? (ulong) sint4korr(to+7): 0;
-
+
+ tm.neg= 0;
+ tm.year= (uint) sint2korr(to);
+ tm.month= (uint) to[2];
+ tm.day= (uint) to[3];
/*
Note, that though ranges of hour, minute and second are not checked
here we rely on them being < 256: otherwise
@@ -393,11 +393,8 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len)
}
else
tm.hour= tm.minute= tm.second= 0;
-
- tm.year= (uint) sint2korr(to);
- tm.month= (uint) to[2];
- tm.day= (uint) to[3];
- tm.neg= 0;
+
+ tm.second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
param->set_time(&tm, TIMESTAMP_DATETIME,
MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
@@ -592,6 +589,7 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
param->item_result_type= STRING_RESULT;
}
}
+ param->param_type= (enum enum_field_types) param_type;
}
#ifndef EMBEDDED_LIBRARY