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 *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 * 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 void sql_type(drizzled::String&) const;
00057 int store_decimal(const drizzled::type::Decimal*);
00058
00059 Item_result result_type () const { return STRING_RESULT; }
00060 int cmp(const unsigned char*, const unsigned char*);
00061 void sort_string(unsigned char*, uint32_t);
00062 uint32_t max_display_length() { return type::Uuid::DISPLAY_LENGTH; }
00063
00064 int store(double ) { return 0; }
00065 inline String *val_str(String *str) { return val_str(str, str); }
00066 uint32_t size_of() const { return sizeof(*this); }
00067
00068 bool get_date(type::Time <ime, uint32_t) const;
00069 bool get_time(type::Time <ime) const;
00070
00071 #ifdef NOT_YET
00072 void generate();
00073 void set(const unsigned char *arg);
00074 #endif
00075
00076 static size_t max_string_length()
00077 {
00078 return type::Uuid::LENGTH;
00079 }
00080 };
00081
00082 }
00083 }
00084
00085