00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <drizzled/field/str.h>
00024
00025 namespace drizzled {
00026 namespace field {
00027
00028 class Time :public Field_str {
00029 public:
00030 Time(unsigned char *ptr_arg,
00031 uint32_t len_arg,
00032 unsigned char *null_ptr_arg,
00033 unsigned char null_bit_arg,
00034 const char *field_name_arg);
00035
00036 Time(bool maybe_null_arg,
00037 const char *field_name_arg);
00038
00039 enum_field_types type() const { return DRIZZLE_TYPE_TIMESTAMP;}
00040 enum ha_base_keytype key_type() const { return HA_KEYTYPE_LONG_INT; }
00041 enum Item_result cmp_type () const { return INT_RESULT; }
00042 int store(const char *to,uint32_t length,
00043 const charset_info_st * const charset);
00044 int store(double nr);
00045 int store(int64_t nr, bool unsigned_val);
00046 int reset(void) { ptr[0]= ptr[1]= ptr[2]= ptr[3]= 0; return 0; }
00047 double val_real(void) const;
00048 int64_t val_int(void) const;
00049 String *val_str(String*,String *) const;
00050 int cmp(const unsigned char *,const unsigned char *);
00051 void sort_string(unsigned char *buff,uint32_t length);
00052 uint32_t pack_length() const { return 4; }
00053 bool can_be_compared_as_int64_t() const { return true; }
00054 bool zero_pack() const { return 0; }
00055
00056
00057 long get_timestamp(bool *null_value) const;
00058 private:
00059 bool get_date(type::Time <ime, uint32_t fuzzydate) const;
00060 bool get_time(type::Time <ime) const;
00061
00062 public:
00063 timestamp_auto_set_type get_auto_set_type() const;
00064 static size_t max_string_length();
00065 void pack_time(drizzled::Time &arg);
00066 void unpack_time(drizzled::Time &arg) const;
00067 void unpack_time(int32_t &destination, const unsigned char *source) const;
00068 };
00069
00070 }
00071 }
00072
00073