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/epoch.h>
00024
00025 namespace drizzled
00026 {
00027
00028 namespace field
00029 {
00030
00031 class TableShare;
00032 typedef struct charset_info_st CHARSET_INFO;
00033
00034 class Microtime :public Epoch {
00035 public:
00036
00037 typedef Microtime* pointer;
00038
00039 Microtime(unsigned char *ptr_arg,
00040 unsigned char *null_ptr_arg,
00041 unsigned char null_bit_arg,
00042 enum utype unireg_check_arg,
00043 const char *field_name_arg,
00044 drizzled::TableShare *share);
00045
00046 Microtime(bool maybe_null_arg,
00047 const char *field_name_arg);
00048
00049 enum_field_types type() const { return DRIZZLE_TYPE_MICROTIME;}
00050 enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
00051 enum Item_result cmp_type () const { return STRING_RESULT; }
00052 int store(const char *to,uint32_t length,
00053 const CHARSET_INFO * const charset);
00054 int store(double nr);
00055 int store(int64_t nr, bool unsigned_val);
00056 int store_time(type::Time <ime, type::timestamp_t t_type);
00057
00058 String *val_str(String*,String *) const;
00059 double val_real(void) const;
00060 int64_t val_int(void) const;
00061 type::Decimal *val_decimal(type::Decimal *decimal_value) const;
00062
00063 int cmp(const unsigned char *,const unsigned char *);
00064 void sort_string(unsigned char *buff,uint32_t length);
00065 uint32_t pack_length() const { return 12; }
00066 void sql_type(String &str) const;
00067 bool can_be_compared_as_int64_t() const { return false; }
00068 bool zero_pack() const { return 0; }
00069 void set_time();
00070
00071
00072 long get_timestamp(bool *null_value) const;
00073
00074 private:
00075 bool get_date(type::Time <ime,uint32_t fuzzydate) const;
00076 bool get_time(type::Time <ime) const;
00077
00078 public:
00079 static size_t max_string_length()
00080 {
00081 return 12;
00082 }
00083 };
00084
00085 }
00086 }
00087
00088