~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
22
 
#include "drizzled/function/time/makedate.h"
23
 
#include "drizzled/time_functions.h"
24
 
 
25
 
namespace drizzled
26
 
{
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
 
22
#include <drizzled/function/time/makedate.h>
27
23
 
28
24
/**
29
25
  MAKEDATE(a,b) is a date function that creates a date value
38
34
String *Item_func_makedate::val_str(String *str)
39
35
{
40
36
  assert(fixed == 1);
41
 
  type::Time l_time;
 
37
  DRIZZLE_TIME l_time;
42
38
  long daynr=  (long) args[1]->val_int();
43
39
  long year= (long) args[0]->val_int();
44
40
  long days;
56
52
  {
57
53
    null_value=0;
58
54
    get_date_from_daynr(days,&l_time.year,&l_time.month,&l_time.day);
59
 
    if (str->alloc(type::Time::MAX_STRING_LENGTH))
 
55
    if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
60
56
      goto err;
61
 
 
62
 
    l_time.convert(*str, type::DRIZZLE_TIMESTAMP_DATE);
63
 
 
 
57
    make_date(&l_time, str);
64
58
    return str;
65
59
  }
66
60
 
83
77
int64_t Item_func_makedate::val_int()
84
78
{
85
79
  assert(fixed == 1);
86
 
  type::Time l_time;
 
80
  DRIZZLE_TIME l_time;
87
81
  long daynr=  (long) args[1]->val_int();
88
82
  long year= (long) args[0]->val_int();
89
83
  long days;
109
103
  return 0;
110
104
}
111
105
 
112
 
} /* namespace drizzled */