23 #include <drizzled/field/str.h>
24 #include <drizzled/charset.h>
48 unsigned char *null_ptr_arg,
49 unsigned char null_bit_arg,
50 const char *field_name_arg,
55 const char *field_name_arg,
59 maybe_null_arg ? (
unsigned char *)
"": 0,
67 enum_field_types type()
const {
return DRIZZLE_TYPE_BLOB;}
68 enum ha_base_keytype key_type()
const
69 {
return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
70 int store(
const char *to,uint32_t length,
73 int store(int64_t nr,
bool unsigned_val);
75 double val_real(
void)
const;
76 int64_t val_int(
void)
const;
79 int cmp_max(
const unsigned char *,
const unsigned char *, uint32_t max_length);
80 int cmp(
const unsigned char *a,
const unsigned char *b)
81 {
return cmp_max(a, b, UINT32_MAX); }
82 int cmp(
const unsigned char *a, uint32_t a_length,
const unsigned char *b, uint32_t b_length);
83 int cmp_binary(
const unsigned char *a,
const unsigned char *b, uint32_t max_length=UINT32_MAX);
84 int key_cmp(
const unsigned char *,
const unsigned char*);
85 int key_cmp(
const unsigned char *str, uint32_t length);
86 uint32_t key_length()
const {
return 0; }
87 void sort_string(
unsigned char *buff,uint32_t length);
88 uint32_t pack_length()
const;
100 {
return (uint32_t) (
sizeof(uint32_t)); }
102 uint32_t sort_length()
const;
105 return (uint32_t) (((uint64_t) 1 << 32) -1);
107 int reset(
void) { memset(ptr, 0,
sizeof(uint32_t)+
sizeof(
unsigned char*));
return 0; }
108 void reset_fields() { memset(&value, 0,
sizeof(value)); }
109 #ifndef WORDS_BIGENDIAN
112 void store_length(
unsigned char *i_ptr, uint32_t i_number,
bool low_byte_first);
113 void store_length(
unsigned char *i_ptr, uint32_t i_number);
128 uint32_t get_packed_size(
const unsigned char *ptr_arg,
bool low_byte_first);
130 DRIZZLED_API uint32_t get_length(uint32_t row_offset= 0)
const;
131 DRIZZLED_API uint32_t get_length(
const unsigned char *ptr,
bool low_byte_first)
const;
132 DRIZZLED_API uint32_t get_length(
const unsigned char *ptr_arg)
const;
133 void put_length(
unsigned char *pos, uint32_t length);
134 inline unsigned char* get_ptr()
const
137 memcpy(&str, ptr +
sizeof(uint32_t),
sizeof(
unsigned char*));
140 inline void set_ptr(
unsigned char *length,
unsigned char *data)
142 memcpy(ptr,length,
sizeof(uint32_t));
143 memcpy(ptr+
sizeof(uint32_t),&data,
sizeof(
char*));
145 void set_ptr_offset(ptrdiff_t ptr_diff, uint32_t length,
unsigned char *data)
147 unsigned char *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,
unsigned char*);
149 memcpy(ptr_ofs+
sizeof(uint32_t),&data,
sizeof(
char*));
151 inline void set_ptr(uint32_t length,
unsigned char *data)
153 set_ptr_offset(0, length, data);
155 uint32_t get_key_image(
unsigned char *buff,uint32_t length);
156 uint32_t get_key_image(std::basic_string<unsigned char> &buff, uint32_t length);
157 void set_key_image(
const unsigned char *buff,uint32_t length);
160 value.copy((
char*)get_ptr(), get_length(), charset());
161 char* tmp= value.ptr();
162 memcpy(ptr +
sizeof(uint32_t), &tmp,
sizeof(
char*));
164 virtual unsigned char *pack(
unsigned char *to,
const unsigned char *from, uint32_t max_length,
bool low_byte_first);
165 unsigned char *pack_key(
unsigned char *to,
const unsigned char *from, uint32_t max_length,
bool low_byte_first);
166 virtual const unsigned char *unpack(
unsigned char *to,
const unsigned char *from, uint32_t ,
bool low_byte_first);
167 void free() { value.free(); }
169 uint32_t size_of()
const {
return sizeof(*this); }
170 bool has_charset(
void)
const
171 {
return charset() != &my_charset_bin; }
172 uint32_t max_display_length();
virtual uint32_t max_data_length() const
TODO: Rename this file - func.h is stupid.
virtual unsigned char * pack(unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first)
int key_cmp(KeyPartInfo *key_part, const unsigned char *key, uint32_t key_length)
Visibility Control Macros.
virtual const unsigned char * unpack(unsigned char *to, const unsigned char *from, uint32_t param_data, bool low_byte_first)
int field_conv(Field *to, Field *from)
uint32_t pack_length_no_ptr() const
static void store_length(unsigned char *to, uint32_t length, uint32_t pack_length)