~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-02-18 19:27:32 UTC
  • mfrom: (873.1.17 temporal-new)
  • Revision ID: brian@tangent.org-20090218192732-ype4iscybtftjk2y
Merge Jay

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/curdate.h>
23
 
#include <drizzled/tztime.h>
24
 
 
25
 
#include <drizzled/session.h>
 
22
#include "drizzled/function/time/curdate.h"
 
23
#include "drizzled/tztime.h"
 
24
#include "drizzled/temporal.h"
 
25
#include "drizzled/session.h"
26
26
 
27
27
void Item_func_curdate::fix_length_and_dec()
28
28
{
35
35
  /* We don't need to set second_part and neg because they already 0 */
36
36
  ltime.hour= ltime.minute= ltime.second= 0;
37
37
  ltime.time_type= DRIZZLE_TIMESTAMP_DATE;
38
 
  value= (int64_t) TIME_to_uint64_t_date(&ltime);
39
 
}
40
38
 
41
 
String *Item_func_curdate::val_str(String *str)
42
 
{
43
 
  assert(fixed == 1);
44
 
  if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
45
 
  {
46
 
    null_value= 1;
47
 
    return (String *) 0;
48
 
  }
49
 
  make_date((DATE_TIME_FORMAT *) 0, &ltime, str);
50
 
  return str;
 
39
  /** 
 
40
   * @TODO Remove ltime completely when timezones are reworked.  Using this
 
41
   * technique now to avoid a large patch...
 
42
   */
 
43
  cached_temporal.set_years(ltime.year);
 
44
  cached_temporal.set_months(ltime.month);
 
45
  cached_temporal.set_days(ltime.day);
51
46
}
52
47
 
53
48
/**
75
70
  */
76
71
}
77
72
 
78
 
bool Item_func_curdate::get_date(DRIZZLE_TIME *res,
79
 
                                 uint32_t )
 
73
bool Item_func_curdate::get_temporal(drizzled::Date &to)
80
74
{
81
 
  *res=ltime;
82
 
  return 0;
 
75
  to= cached_temporal;
 
76
  return true;
83
77
}
84
 
 
85