List:Commits« Previous MessageNext Message »
From:kpettersson Date:October 10 2006 8:37am
Subject:bk commit into 5.1 tree (Kristofer.Pettersson:1.2346) BUG#21811
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of Kristofer Pettersson. When Kristofer Pettersson does a push these
changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-10-10 08:37:03+02:00, Kristofer.Pettersson@naruto. +2 -0
  BUG#21811 Odd casting with date + INTERVAL arithmetic
  - Type casting was not consequent, thus when adding a DATE type with
    a WEEK interval the result tpe was DATETIME and not DATE as is the
    norm.
  - By changing the order of the date type enumerations the type casting
    bug is resolved. To comply with the new order the array 
    interval_type_to_name needed to change accordingly.

  include/my_time.h@stripped, 2006-10-10 08:36:59+02:00, Kristofer.Pettersson@naruto. +11 -5
    Changed enumeration order to make week interval appear in a more
    logical order. This affects type casting when a date is added to an
    interval.

  sql/time.cc@stripped, 2006-10-10 08:37:00+02:00, Kristofer.Pettersson@naruto. +9 -1
    Moved string WEEK to match enumeration in interval_type

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	Kristofer.Pettersson
# Host:	naruto.
# Root:	C:/cpp/bug21811/my51-bug21811

--- 1.67/sql/time.cc	2006-10-10 08:37:23 +02:00
+++ 1.68/sql/time.cc	2006-10-10 08:37:23 +02:00
@@ -25,14 +25,22 @@
 
 #ifndef TESTTIME
 
+/*
+  Name description of interval names used in statements.
+
+  'interval_type_to_name' is ordered and sorted on interval size and
+  interval complexity.
+  See also interval_type
+*/
+
 LEX_STRING interval_type_to_name[INTERVAL_LAST] = {
   { C_STRING_WITH_LEN("YEAR")},
   { C_STRING_WITH_LEN("QUARTER")},
   { C_STRING_WITH_LEN("MONTH")},
+  { C_STRING_WITH_LEN("WEEK")},
   { C_STRING_WITH_LEN("DAY")},
   { C_STRING_WITH_LEN("HOUR")},
   { C_STRING_WITH_LEN("MINUTE")},
-  { C_STRING_WITH_LEN("WEEK")},
   { C_STRING_WITH_LEN("SECOND")},
   { C_STRING_WITH_LEN("MICROSECOND")},
   { C_STRING_WITH_LEN("YEAR_MONTH")},

--- 1.14/include/my_time.h	2006-10-10 08:37:23 +02:00
+++ 1.15/include/my_time.h	2006-10-10 08:37:23 +02:00
@@ -92,15 +92,21 @@
 int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
 int my_TIME_to_str(const MYSQL_TIME *l_time, char *to);
 
-/*
-  The following must be sorted so that simple intervals comes first.
-  (get_interval_value() depends on this)
+/* 
+  Available interval types used in any statement.
+
+  'interval_type' must be sorted so that simple intervals comes first,
+  ie year, quarter, month, week, day, hour, etc. The order based on
+  interval size is also important and the intervals should be kept in a
+  large to smaller order. (get_interval_value() depends on this)
+  
+  See also interval_type_to_name, get_interval_value
 */
 
 enum interval_type
 {
-  INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_DAY, INTERVAL_HOUR,
-  INTERVAL_MINUTE, INTERVAL_WEEK, INTERVAL_SECOND, INTERVAL_MICROSECOND ,
+  INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_WEEK, INTERVAL_DAY,
+  INTERVAL_HOUR, INTERVAL_MINUTE, INTERVAL_SECOND, INTERVAL_MICROSECOND,
   INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE,
   INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND,
   INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND,


Thread
bk commit into 5.1 tree (Kristofer.Pettersson:1.2346) BUG#21811kpettersson10 Oct