43
40
static const uint32_t MAX_SIZE;
45
41
/* Store number of bytes used to store length (1 or 2) */
46
42
uint32_t length_bytes;
48
43
Field_varstring(unsigned char *ptr_arg,
50
45
uint32_t length_bytes_arg,
51
46
unsigned char *null_ptr_arg,
52
47
unsigned char null_bit_arg,
53
48
const char *field_name_arg,
54
50
const CHARSET_INFO * const cs);
55
51
Field_varstring(uint32_t len_arg,
56
52
bool maybe_null_arg,
57
53
const char *field_name_arg,
58
55
const CHARSET_INFO * const cs);
60
57
enum_field_types type() const { return DRIZZLE_TYPE_VARCHAR; }
61
58
enum ha_base_keytype key_type() const;
59
uint32_t row_pack_length() { return field_length; }
62
60
bool zero_pack() const { return 0; }
63
61
int reset(void) { memset(ptr, 0, field_length+length_bytes); return 0; }
64
62
uint32_t pack_length() const { return (uint32_t) field_length+length_bytes; }
65
uint32_t pack_length_no_ptr() const { return length_bytes; }
66
63
uint32_t key_length() const { return (uint32_t) field_length; }
67
64
uint32_t sort_length() const
69
66
return (uint32_t) field_length + (field_charset == &my_charset_bin ?
72
69
int store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
90
87
uint32_t get_key_image(std::basic_string <unsigned char> &buff, uint32_t length);
91
88
void set_key_image(const unsigned char *buff,uint32_t length);
92
89
void sql_type(String &str) const;
93
virtual unsigned char *pack(unsigned char *to,
90
virtual unsigned char *pack(unsigned char *to,
94
91
const unsigned char *from,
95
92
uint32_t max_length,
96
93
bool low_byte_first);
95
unsigned char *pack_key(unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first);
96
unsigned char *pack_key_from_key_image(unsigned char* to,
97
const unsigned char *from,
98
100
virtual const unsigned char *unpack(unsigned char* to,
99
101
const unsigned char *from,
100
102
uint32_t param_data,
101
103
bool low_byte_first);
105
const unsigned char *unpack_key(unsigned char* to, const unsigned char *from,
106
uint32_t max_length, bool low_byte_first);
107
int pack_cmp(const unsigned char *a, const unsigned char *b, uint32_t key_length,
108
bool insert_or_update);
109
int pack_cmp(const unsigned char *b, uint32_t key_length,bool insert_or_update);
103
110
int cmp_binary(const unsigned char *a,const unsigned char *b, uint32_t max_length=UINT32_MAX);
104
111
int key_cmp(const unsigned char *,const unsigned char*);
105
112
int key_cmp(const unsigned char *str, uint32_t length);
113
uint32_t packed_col_length(const unsigned char *to, uint32_t length);
106
114
uint32_t max_packed_col_length(uint32_t max_length);
115
uint32_t data_length();
107
116
uint32_t used_length();
108
117
uint32_t size_of() const { return sizeof(*this); }
109
118
enum_field_types real_type() const { return DRIZZLE_TYPE_VARCHAR; }
110
119
bool has_charset(void) const
111
120
{ return charset() == &my_charset_bin ? false : true; }
112
Field *new_field(memory::Root *root, Table *new_table, bool keep_type);
113
Field *new_key_field(memory::Root *root, Table *new_table,
121
Field *new_field(MEM_ROOT *root, Table *new_table, bool keep_type);
122
Field *new_key_field(MEM_ROOT *root, Table *new_table,
114
123
unsigned char *new_ptr, unsigned char *new_null_ptr,
115
124
uint32_t new_null_bit);
125
uint32_t is_equal(CreateField *new_field);
126
void hash(uint32_t *nr, uint32_t *nr2);
128
int do_save_field_metadata(unsigned char *first_byte);
118
} /* namespace drizzled */
120
131
#endif /* DRIZZLED_FIELD_VARSTRING_H */