~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/time/date_add_interval.cc

Merged captain branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <drizzled/server_includes.h>
21
21
#include CSTDINT_H
22
22
#include <drizzled/function/time/date_add_interval.h>
23
 
#include <drizzled/function/time/get_interval_value.h>
 
23
#include <drizzled/temporal_interval.h>
24
24
 
25
25
/*
26
26
   'interval_names' reflects the order of the enumeration interval_type.
77
77
 
78
78
bool Item_date_add_interval::get_date(DRIZZLE_TIME *ltime, uint32_t )
79
79
{
80
 
  INTERVAL interval;
81
 
 
82
 
  if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE) ||
83
 
      get_interval_value(args[1], int_type, &value, &interval))
84
 
    return (null_value=1);
 
80
  drizzled::TemporalInterval interval;
 
81
 
 
82
  if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE))
 
83
    return (null_value= true);
 
84
 
 
85
  if (interval.initFromItem(args[1], int_type, &value))
 
86
    return (null_value= true);
85
87
 
86
88
  if (date_sub_interval)
87
 
    interval.neg = !interval.neg;
88
 
 
89
 
  if ((null_value= date_add_interval(ltime, int_type, interval)))
90
 
    return 1;
91
 
  return 0;
 
89
    interval.toggleNegative();
 
90
 
 
91
  if ((null_value= interval.addDate(ltime, int_type)))
 
92
    return true;
 
93
 
 
94
  return false;
92
95
}
93
96
 
94
97
String *Item_date_add_interval::val_str(String *str)