97
95
@returns The length of the raw data itself without the pointer.
99
97
uint32_t pack_length_no_ptr() const
100
{ return (uint32_t) (packlength); }
98
{ return (uint32_t) (sizeof(uint32_t)); }
101
99
uint32_t row_pack_length() { return pack_length_no_ptr(); }
102
100
uint32_t sort_length() const;
103
101
virtual uint32_t max_data_length() const
105
return (uint32_t) (((uint64_t) 1 << (packlength*8)) -1);
103
return (uint32_t) (((uint64_t) 1 << 32) -1);
107
int reset(void) { memset(ptr, 0, packlength+sizeof(unsigned char*)); return 0; }
105
int reset(void) { memset(ptr, 0, sizeof(uint32_t)+sizeof(unsigned char*)); return 0; }
108
106
void reset_fields() { memset(&value, 0, sizeof(value)); }
109
107
#ifndef WORDS_BIGENDIAN
112
void store_length(unsigned char *i_ptr, uint32_t i_packlength,
113
uint32_t i_number, bool low_byte_first);
114
void store_length(unsigned char *i_ptr, uint32_t i_packlength,
110
void store_length(unsigned char *i_ptr, uint32_t i_number, bool low_byte_first);
111
void store_length(unsigned char *i_ptr, uint32_t i_number);
117
113
inline void store_length(uint32_t number)
119
store_length(ptr, packlength, number);
115
store_length(ptr, number);
130
126
uint32_t get_packed_size(const unsigned char *ptr_arg, bool low_byte_first);
132
128
uint32_t get_length(uint32_t row_offset= 0);
133
uint32_t get_length(const unsigned char *ptr, uint32_t packlength,
134
bool low_byte_first);
129
uint32_t get_length(const unsigned char *ptr, bool low_byte_first);
135
130
uint32_t get_length(const unsigned char *ptr_arg);
136
131
void put_length(unsigned char *pos, uint32_t length);
137
132
inline void get_ptr(unsigned char **str)
139
memcpy(str,ptr+packlength,sizeof(unsigned char*));
134
memcpy(str,ptr+sizeof(uint32_t),sizeof(unsigned char*));
141
136
inline void get_ptr(unsigned char **str, uint32_t row_offset)
143
memcpy(str,ptr+packlength+row_offset,sizeof(char*));
138
memcpy(str,ptr+sizeof(uint32_t)+row_offset,sizeof(char*));
145
140
inline void set_ptr(unsigned char *length, unsigned char *data)
147
memcpy(ptr,length,packlength);
148
memcpy(ptr+packlength,&data,sizeof(char*));
142
memcpy(ptr,length,sizeof(uint32_t));
143
memcpy(ptr+sizeof(uint32_t),&data,sizeof(char*));
150
145
void set_ptr_offset(ptrdiff_t ptr_diff, uint32_t length, unsigned char *data)
152
147
unsigned char *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,unsigned char*);
153
store_length(ptr_ofs, packlength, length);
154
memcpy(ptr_ofs+packlength,&data,sizeof(char*));
148
store_length(ptr_ofs, length);
149
memcpy(ptr_ofs+sizeof(uint32_t),&data,sizeof(char*));
156
151
inline void set_ptr(uint32_t length, unsigned char *data)
173
168
tmp=(unsigned char*) value.ptr();
174
memcpy(ptr+packlength,&tmp,sizeof(char*));
169
memcpy(ptr+sizeof(uint32_t),&tmp,sizeof(char*));
177
172
virtual unsigned char *pack(unsigned char *to, const unsigned char *from,
179
174
unsigned char *pack_key(unsigned char *to, const unsigned char *from,
180
175
uint32_t max_length, bool low_byte_first);
181
176
virtual const unsigned char *unpack(unsigned char *to, const unsigned char *from,
182
uint32_t param_data, bool low_byte_first);
177
uint32_t , bool low_byte_first);
183
178
void free() { value.free(); }
184
179
inline void clear_temporary() { memset(&value, 0, sizeof(value)); }
185
180
friend int field_conv(Field *to,Field *from);