~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/time/date.h

  • Committer: Brian Aker
  • Date: 2009-10-16 10:27:33 UTC
  • mfrom: (1183.1.4 merge)
  • Revision ID: brian@gaz-20091016102733-b10po5oup0hjlilh
Merge Engine changes.

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
24
24
#include "drizzled/function/str/strfunc.h"
25
25
#include <drizzled/temporal.h>
26
26
 
27
 
namespace drizzled
28
 
{
29
 
 
30
27
/* A function which evaluates to a Date */
31
28
class Item_date :public Item_func
32
29
{
45
42
  {
46
43
    collation.set(&my_charset_bin);
47
44
    decimals=0;
48
 
    max_length=Date::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
 
45
    max_length=drizzled::Date::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
49
46
  }
50
47
  /**
51
48
   * All functions which inherit from Item_date must implement
52
49
   * their own get_temporal() method, which takes a supplied
53
 
   * Date reference and populates it with a correct
 
50
   * drizzled::Date reference and populates it with a correct
54
51
   * date based on the semantics of the function.
55
52
   *
56
53
   * Returns whether the function was able to correctly fill
57
54
   * the supplied date temporal with a proper date.
58
55
   *
59
 
   * @param Reference to a Date to populate
 
56
   * @param Reference to a drizzled::Date to populate
60
57
   */
61
 
  virtual bool get_temporal(Date &temporal)= 0;
 
58
  virtual bool get_temporal(drizzled::Date &temporal)= 0;
62
59
  Field *tmp_table_field(Table *table)
63
60
  {
64
61
    return tmp_table_field_from_field_type(table, 0);
65
62
  }
66
63
  bool result_as_int64_t() { return true; }
67
 
  type::Decimal *val_decimal(type::Decimal *decimal_value)
 
64
  my_decimal *val_decimal(my_decimal *decimal_value)
68
65
  {
69
66
    assert(fixed == 1);
70
67
    return  val_decimal_from_date(decimal_value);
92
89
  }
93
90
  bool result_as_int64_t() { return true; }
94
91
  double val_real() { return (double) val_int(); }
95
 
  type::Decimal *val_decimal(type::Decimal *decimal_value)
 
92
  my_decimal *val_decimal(my_decimal *decimal_value)
96
93
  {
97
94
    assert(fixed == 1);
98
95
    return  val_decimal_from_date(decimal_value);
104
101
  }
105
102
};
106
103
 
107
 
} /* namespace drizzled */
108
 
 
109
104
#endif /* DRIZZLED_FUNCTION_TIME_DATE_H */