~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Jay Pipes
  • Date: 2009-02-28 17:49:35 UTC
  • mto: (910.2.6 mordred-noatomics)
  • mto: This revision was merged to the branch mainline in revision 908.
  • Revision ID: jpipes@serialcoder-20090228174935-yfgsw7m0n9gx8pka
Merging in old r903 temporal changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <drizzled/server_includes.h>
 
20
#include "drizzled/server_includes.h"
21
21
#include CSTDINT_H
22
 
#include <drizzled/function/time/period_add.h>
 
22
#include "drizzled/function/time/period_add.h"
 
23
#include "drizzled/calendar.h"
23
24
 
24
25
int64_t Item_func_period_add::val_int()
25
26
{
26
27
  assert(fixed == 1);
27
 
  uint32_t period= (uint32_t)args[0]->val_int();
28
 
  int months=(int) args[1]->val_int();
 
28
  uint32_t period= (uint32_t) args[0]->val_int();
 
29
  uint32_t months= (uint32_t) args[1]->val_int();
29
30
 
30
 
  if ((null_value=args[0]->null_value || args[1]->null_value) ||
 
31
  if ((null_value= args[0]->null_value || args[1]->null_value) ||
31
32
      period == 0L)
32
33
    return 0; /* purecov: inspected */
33
 
  return (int64_t)
34
 
    convert_month_to_period((uint) ((int) convert_period_to_month(period)+
35
 
                                    months));
 
34
 
 
35
  return (int64_t) months_to_year_month(year_month_to_months(period) + months);
36
36
}
37