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.h>
00024 #include <string>
00025
00026 #include <drizzled/type/uuid.h>
00027
00028 namespace drizzled
00029 {
00030 namespace field
00031 {
00032
00033 class Uuid :public Field {
00034 const charset_info_st *field_charset;
00035 bool is_set;
00036
00037 public:
00038 Uuid(unsigned char *ptr_arg,
00039 uint32_t len_arg,
00040 unsigned char *null_ptr_arg,
00041 unsigned char null_bit_arg,
00042 const char *field_name_arg);
00043
00044 enum_field_types type() const { return DRIZZLE_TYPE_UUID; }
00045 enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
00046 bool zero_pack() const { return 0; }
00047 int reset(void) { memset(ptr, 0, type::Uuid::LENGTH); return 0; }
00048 uint32_t pack_length() const { return type::Uuid::LENGTH; }
00049 uint32_t key_length() const { return type::Uuid::LENGTH; }
00050
00051 int store(const char *to, uint32_t length, const charset_info_st * const charset);
00052 int store(int64_t nr, bool unsigned_val);
00053 double val_real() const;
00054 int64_t val_int() const;
00055 String *val_str(String*,String *) const;
00056 int store_decimal(const drizzled::type::Decimal*);
00057
00058 Item_result result_type () const { return STRING_RESULT; }
00059 int cmp(const unsigned char*, const unsigned char*);
00060 void sort_string(unsigned char*, uint32_t);
00061 uint32_t max_display_length() { return type::Uuid::DISPLAY_LENGTH; }
00062
00063 int store(double ) { return 0; }
00064 inline String *val_str(String *str) { return val_str(str, str); }
00065 uint32_t size_of() const { return sizeof(*this); }
00066
00067 bool get_date(type::Time <ime, uint32_t) const;
00068 bool get_time(type::Time <ime) const;
00069
00070 #ifdef NOT_YET
00071 void generate();
00072 void set(const unsigned char *arg);
00073 #endif
00074
00075 static size_t max_string_length()
00076 {
00077 return type::Uuid::LENGTH;
00078 }
00079 };
00080
00081 }
00082 }
00083
00084