Commit 4f295835 authored by unknown's avatar unknown

local variable interval to interval_tmp because it hides

Event_timed::interval

parent bdda0116
...@@ -324,7 +324,7 @@ int ...@@ -324,7 +324,7 @@ int
Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval) Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
{ {
String value; String value;
INTERVAL interval; INTERVAL interval_tmp;
DBUG_ENTER("Event_timed::init_interval"); DBUG_ENTER("Event_timed::init_interval");
...@@ -332,71 +332,74 @@ Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval) ...@@ -332,71 +332,74 @@ Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
DBUG_RETURN(EVEX_PARSE_ERROR); DBUG_RETURN(EVEX_PARSE_ERROR);
value.alloc(MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN); value.alloc(MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN);
if (get_interval_value(expr, new_interval, &value, &interval)) if (get_interval_value(expr, new_interval, &value, &interval_tmp))
DBUG_RETURN(EVEX_PARSE_ERROR); DBUG_RETURN(EVEX_PARSE_ERROR);
expression= 0; expression= 0;
switch (new_interval) { switch (new_interval) {
case INTERVAL_YEAR: case INTERVAL_YEAR:
expression= interval.year; expression= interval_tmp.year;
break; break;
case INTERVAL_QUARTER: case INTERVAL_QUARTER:
case INTERVAL_MONTH: case INTERVAL_MONTH:
expression= interval.month; expression= interval_tmp.month;
break; break;
case INTERVAL_WEEK: case INTERVAL_WEEK:
case INTERVAL_DAY: case INTERVAL_DAY:
expression= interval.day; expression= interval_tmp.day;
break; break;
case INTERVAL_HOUR: case INTERVAL_HOUR:
expression= interval.hour; expression= interval_tmp.hour;
break; break;
case INTERVAL_MINUTE: case INTERVAL_MINUTE:
expression= interval.minute; expression= interval_tmp.minute;
break; break;
case INTERVAL_SECOND: case INTERVAL_SECOND:
expression= interval.second; expression= interval_tmp.second;
break; break;
case INTERVAL_YEAR_MONTH: // Allow YEAR-MONTH YYYYYMM case INTERVAL_YEAR_MONTH: // Allow YEAR-MONTH YYYYYMM
expression= interval.year* 12 + interval.month; expression= interval_tmp.year* 12 + interval_tmp.month;
break; break;
case INTERVAL_DAY_HOUR: case INTERVAL_DAY_HOUR:
expression= interval.day* 24 + interval.hour; expression= interval_tmp.day* 24 + interval_tmp.hour;
break; break;
case INTERVAL_DAY_MINUTE: case INTERVAL_DAY_MINUTE:
expression= (interval.day* 24 + interval.hour) * 60 + interval.minute; expression= (interval_tmp.day* 24 + interval_tmp.hour) * 60 +
interval_tmp.minute;
break; break;
case INTERVAL_HOUR_SECOND: /* day is anyway 0 */ case INTERVAL_HOUR_SECOND: /* day is anyway 0 */
case INTERVAL_DAY_SECOND: case INTERVAL_DAY_SECOND:
/* DAY_SECOND having problems because of leap seconds? */ /* DAY_SECOND having problems because of leap seconds? */
expression= ((interval.day* 24 + interval.hour) * 60 + interval.minute)*60 expression= ((interval_tmp.day* 24 + interval_tmp.hour) * 60 +
+ interval.second; interval_tmp.minute)*60
+ interval_tmp.second;
break; break;
case INTERVAL_MINUTE_MICROSECOND: /* day and hour are 0 */ case INTERVAL_MINUTE_MICROSECOND: /* day and hour are 0 */
case INTERVAL_HOUR_MICROSECOND: /* day is anyway 0 */ case INTERVAL_HOUR_MICROSECOND: /* day is anyway 0 */
case INTERVAL_DAY_MICROSECOND: case INTERVAL_DAY_MICROSECOND:
DBUG_RETURN(EVEX_MICROSECOND_UNSUP); DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
expression= ((((interval.day*24) + interval.hour)*60+interval.minute)*60 + expression= ((((interval_tmp.day*24) + interval_tmp.hour)*60+
interval.second) * 1000000L + interval.second_part; interval_tmp.minute)*60 +
interval_tmp.second) * 1000000L + interval_tmp.second_part;
break; break;
case INTERVAL_HOUR_MINUTE: case INTERVAL_HOUR_MINUTE:
expression= interval.hour * 60 + interval.minute; expression= interval_tmp.hour * 60 + interval_tmp.minute;
break; break;
case INTERVAL_MINUTE_SECOND: case INTERVAL_MINUTE_SECOND:
expression= interval.minute * 60 + interval.second; expression= interval_tmp.minute * 60 + interval_tmp.second;
break; break;
case INTERVAL_SECOND_MICROSECOND: case INTERVAL_SECOND_MICROSECOND:
DBUG_RETURN(EVEX_MICROSECOND_UNSUP); DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
expression= interval.second * 1000000L + interval.second_part; expression= interval_tmp.second * 1000000L + interval_tmp.second_part;
break; break;
case INTERVAL_MICROSECOND: case INTERVAL_MICROSECOND:
DBUG_RETURN(EVEX_MICROSECOND_UNSUP); DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
} }
if (interval.neg || expression > EVEX_MAX_INTERVAL_VALUE) if (interval_tmp.neg || expression > EVEX_MAX_INTERVAL_VALUE)
DBUG_RETURN(EVEX_BAD_PARAMS); DBUG_RETURN(EVEX_BAD_PARAMS);
this->interval= new_interval; interval= new_interval;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment