summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authormonty@mashka.mysql.fi <>2003-03-12 14:34:54 +0200
committermonty@mashka.mysql.fi <>2003-03-12 14:34:54 +0200
commitfef194fcb8859d2f5523eaf8e70eb949357ecbea (patch)
treefa15763d811c418cefae92a3f790e6e785618918 /sql/field.cc
parentd57c2019d1501c7bd7d4b4cf4211c8cedc56e706 (diff)
downloadmariadb-git-fef194fcb8859d2f5523eaf8e70eb949357ecbea.tar.gz
Fix for --new option (Timestamp in YYYY-MM-DD HH:MM:SS format)
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc
index b8c63db6708..ce5e240aba8 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2421,6 +2421,14 @@ void Field_double::sql_type(String &res) const
** by handler.cc. The form->timestamp points at the automatic timestamp.
****************************************************************************/
+enum Item_result Field_timestamp::result_type() const
+{
+ return (!current_thd->variables.new_mode &&
+ (field_length == 8 || field_length == 14) ? INT_RESULT :
+ STRING_RESULT);
+}
+
+
Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
enum utype unireg_check_arg,
const char *field_name_arg,
@@ -2783,6 +2791,23 @@ void Field_timestamp::set_time()
longstore(ptr,tmp);
}
+/*
+ This is an exact copy of Field_num except that 'length' is depending
+ on --new mode
+*/
+
+void Field_timestamp::make_field(Send_field *field)
+{
+ field->table_name=table_name;
+ field->col_name=field_name;
+ /* If --new, then we are using "YYYY-MM-DD HH:MM:SS" format */
+ field->length= current_thd->variables.new_mode ? 19 : field_length;
+ field->type=type();
+ field->flags=table->maybe_null ? (flags & ~NOT_NULL_FLAG) : flags;
+ field->decimals=dec;
+}
+
+
/****************************************************************************
** time type
** In string context: HH:MM:SS