~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/epoch.h

Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_FIELD_TIMESTAMP_H
22
 
#define DRIZZLED_FIELD_TIMESTAMP_H
 
21
#ifndef DRIZZLED_FIELD_EPOCH_H
 
22
#define DRIZZLED_FIELD_EPOCH_H
23
23
 
24
24
#include <drizzled/field/str.h>
25
25
 
26
26
namespace drizzled
27
27
{
28
28
 
 
29
namespace field
 
30
{
 
31
 
29
32
class TableShare;
30
33
typedef struct charset_info_st CHARSET_INFO;
31
34
 
32
 
class Field_timestamp :public Field_str {
 
35
class Epoch :public Field_str {
33
36
public:
34
37
 
 
38
  typedef Epoch* pointer;
 
39
 
35
40
  using Field::val_int;
36
41
  using Field::val_str;
37
42
  using Field::cmp;
38
43
  using Field::store;
39
 
  Field_timestamp(unsigned char *ptr_arg,
40
 
                  uint32_t len_arg,
41
 
                  unsigned char *null_ptr_arg,
42
 
                  unsigned char null_bit_arg,
43
 
                  enum utype unireg_check_arg,
44
 
                  const char *field_name_arg,
45
 
                  TableShare *share,
46
 
                  const CHARSET_INFO * const cs);
47
 
  Field_timestamp(bool maybe_null_arg,
48
 
                  const char *field_name_arg,
49
 
                  const CHARSET_INFO * const cs);
 
44
 
 
45
  Epoch(unsigned char *ptr_arg,
 
46
        uint32_t len_arg,
 
47
        unsigned char *null_ptr_arg,
 
48
        unsigned char null_bit_arg,
 
49
        enum utype unireg_check_arg,
 
50
        const char *field_name_arg,
 
51
        drizzled::TableShare *share,
 
52
        const drizzled::CHARSET_INFO * const cs);
 
53
 
 
54
  Epoch(bool maybe_null_arg,
 
55
        const char *field_name_arg,
 
56
        const CHARSET_INFO * const cs);
 
57
 
50
58
  enum_field_types type() const { return DRIZZLE_TYPE_TIMESTAMP;}
51
59
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
52
60
  enum Item_result cmp_type () const { return INT_RESULT; }
69
77
 
70
78
  /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
71
79
  long get_timestamp(bool *null_value);
 
80
 
72
81
private:
73
 
  void store_timestamp(int64_t timestamp);
74
82
  bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate);
75
83
  bool get_time(DRIZZLE_TIME *ltime);
 
84
 
76
85
public:
77
86
  timestamp_auto_set_type get_auto_set_type() const;
 
87
  static size_t max_string_length();
78
88
};
79
89
 
 
90
} /* namespace field */
80
91
} /* namespace drizzled */
81
92
 
82
 
#endif /* DRIZZLED_FIELD_TIMESTAMP_H */
 
93
#endif /* DRIZZLED_FIELD_EPOCH_H */
83
94