~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2010-02-05 08:11:15 UTC
  • mfrom: (1283 build)
  • mto: (1273.13.43 fix_is)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: mordred@inaugust.com-20100205081115-dr82nvrwv4lvw7sd
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
#include "config.h"
21
 
#include CSTDINT_H
 
21
 
22
22
#include "drizzled/function/time/date_add_interval.h"
23
23
#include "drizzled/temporal_interval.h"
24
24
#include "drizzled/time_functions.h"
25
25
 
 
26
namespace drizzled
 
27
{
 
28
 
26
29
/*
27
30
   'interval_names' reflects the order of the enumeration interval_type.
28
31
   See item/time.h
45
48
 
46
49
  collation.set(&my_charset_bin);
47
50
  maybe_null=1;
48
 
  max_length=drizzled::DateTime::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
 
51
  max_length=DateTime::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
49
52
  value.alloc(max_length);
50
53
 
51
54
  /*
78
81
 
79
82
bool Item_date_add_interval::get_date(DRIZZLE_TIME *ltime, uint32_t )
80
83
{
81
 
  drizzled::TemporalInterval interval;
 
84
  TemporalInterval interval;
82
85
 
83
86
  if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE))
84
87
    return (null_value= true);
108
111
  else if (ltime.second_part)
109
112
  {
110
113
    /* Ensure we've got enough room for our timestamp string. */
111
 
    str->length(drizzled::DateTime::MAX_STRING_LENGTH);
112
 
    size_t length= snprintf(str->c_ptr(), drizzled::DateTime::MAX_STRING_LENGTH,
 
114
    str->length(DateTime::MAX_STRING_LENGTH);
 
115
    size_t length= snprintf(str->c_ptr(), DateTime::MAX_STRING_LENGTH,
113
116
                            "%04u-%02u-%02u %02u:%02u:%02u.%06u",
114
117
                            ltime.year,
115
118
                            ltime.month,
160
163
  str->append(interval_names[int_type]);
161
164
  str->append(')');
162
165
}
 
166
 
 
167
} /* namespace drizzled */