#include <field.h>
Inheritance diagram for Field_bit:


Public Member Functions | |
| Field_bit (char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg, enum utype unireg_check_arg, const char *field_name_arg) | |
| enum_field_types | type () const |
| enum ha_base_keytype | key_type () const |
| uint32 | key_length () const |
| uint32 | max_length () |
| uint | size_of () const |
| Item_result | result_type () const |
| void | reset (void) |
| int | store (const char *to, uint length, CHARSET_INFO *charset) |
| int | store (double nr) |
| int | store (longlong nr, bool unsigned_val) |
| int | store_decimal (const my_decimal *) |
| double | val_real (void) |
| longlong | val_int (void) |
| String * | val_str (String *, String *) |
| virtual bool | str_needs_quotes () |
| my_decimal * | val_decimal (my_decimal *) |
| int | cmp (const char *a, const char *b) |
| int | cmp_binary_offset (uint row_offset) |
| int | cmp_max (const char *a, const char *b, uint max_length) |
| int | key_cmp (const byte *a, const byte *b) |
| int | key_cmp (const byte *str, uint length) |
| int | cmp_offset (uint row_offset) |
| void | get_key_image (char *buff, uint length, imagetype type) |
| void | set_key_image (char *buff, uint length) |
| void | sort_string (char *buff, uint length) |
| uint32 | pack_length () const |
| uint32 | pack_length_in_rec () const |
| void | sql_type (String &str) const |
| char * | pack (char *to, const char *from, uint max_length=~(uint) 0) |
| const char * | unpack (char *to, const char *from) |
| Field * | new_key_field (MEM_ROOT *root, struct st_table *new_table, char *new_ptr, uchar *new_null_ptr, uint new_null_bit) |
| void | set_bit_ptr (uchar *bit_ptr_arg, uchar bit_ofs_arg) |
| bool | eq (Field *field) |
| void | move_field_offset (my_ptrdiff_t ptr_diff) |
Public Attributes | |
| uchar * | bit_ptr |
| uchar | bit_ofs |
| uint | bit_len |
| uint | bytes_in_rec |
Definition at line 1371 of file field.h.
| Field_bit::Field_bit | ( | char * | ptr_arg, | |
| uint32 | len_arg, | |||
| uchar * | null_ptr_arg, | |||
| uchar | null_bit_arg, | |||
| uchar * | bit_ptr_arg, | |||
| uchar | bit_ofs_arg, | |||
| enum utype | unireg_check_arg, | |||
| const char * | field_name_arg | |||
| ) |
Definition at line 8072 of file field.cc.
References Field::null_bit.
08075 : Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 08076 unireg_check_arg, field_name_arg), 08077 bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7), 08078 bytes_in_rec(len_arg / 8) 08079 { 08080 /* 08081 Ensure that Field::eq() can distinguish between two different bit fields. 08082 (two bit fields that are not null, may have same ptr and null_ptr) 08083 */ 08084 if (!null_ptr_arg) 08085 null_bit= bit_ofs_arg; 08086 }
| int Field_bit::cmp | ( | const char * | a, | |
| const char * | b | |||
| ) | [inline, virtual] |
Implements Field.
Definition at line 1396 of file field.h.
References Field::cmp_binary().
01397 { return cmp_binary(a, b); }
Here is the call graph for this function:

| int Field_bit::cmp_binary_offset | ( | uint | row_offset | ) | [inline, virtual] |
Reimplemented from Field.
Definition at line 1398 of file field.h.
References cmp_offset().
01399 { return cmp_offset(row_offset); }
Here is the call graph for this function:

| int Field_bit::cmp_max | ( | const char * | a, | |
| const char * | b, | |||
| uint | max_length | |||
| ) | [virtual] |
Reimplemented from Field.
Definition at line 8247 of file field.cc.
References bit_len, bit_ofs, bit_ptr, Field::field_length, flag, get_rec_bits, and memcmp().
08248 { 08249 my_ptrdiff_t a_diff= a - ptr; 08250 my_ptrdiff_t b_diff= b - ptr; 08251 if (bit_len) 08252 { 08253 int flag; 08254 uchar bits_a= get_rec_bits(bit_ptr+a_diff, bit_ofs, bit_len); 08255 uchar bits_b= get_rec_bits(bit_ptr+b_diff, bit_ofs, bit_len); 08256 if ((flag= (int) (bits_a - bits_b))) 08257 return flag; 08258 } 08259 return memcmp(a, b, field_length); 08260 }
Here is the call graph for this function:

| int Field_bit::cmp_offset | ( | uint | row_offset | ) | [virtual] |
Reimplemented from Field.
Definition at line 8278 of file field.cc.
References bit_len, bit_ofs, bit_ptr, bytes_in_rec, flag, get_rec_bits, and memcmp().
Referenced by cmp_binary_offset().
08279 { 08280 if (bit_len) 08281 { 08282 int flag; 08283 uchar bits_a= get_rec_bits(bit_ptr, bit_ofs, bit_len); 08284 uchar bits_b= get_rec_bits(bit_ptr + row_offset, bit_ofs, bit_len); 08285 if ((flag= (int) (bits_a - bits_b))) 08286 return flag; 08287 } 08288 return memcmp(ptr, ptr + row_offset, bytes_in_rec); 08289 }
Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from Field.
Definition at line 1423 of file field.h.
References bit_ofs, bit_ptr, Field::eq(), and type().
01424 { 01425 return (Field::eq(field) && 01426 field->type() == type() && 01427 bit_ptr == ((Field_bit *)field)->bit_ptr && 01428 bit_ofs == ((Field_bit *)field)->bit_ofs); 01429 }
Here is the call graph for this function:

Definition at line 8292 of file field.cc.
References bit_len, bit_ofs, bit_ptr, bytes_in_rec, get_rec_bits, memcpy, and min.
Referenced by sort_string().
08293 { 08294 if (bit_len) 08295 { 08296 uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len); 08297 *buff++= bits; 08298 length--; 08299 } 08300 memcpy(buff, ptr, min(length, bytes_in_rec)); 08301 }
Here is the caller graph for this function:

Reimplemented from Field.
Definition at line 8263 of file field.cc.
References bit_len, bit_ofs, bit_ptr, flag, get_rec_bits, and memcmp().
08264 { 08265 if (bit_len) 08266 { 08267 int flag; 08268 uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len); 08269 if ((flag= (int) (bits - *(uchar*) str))) 08270 return flag; 08271 str++; 08272 length--; 08273 } 08274 return memcmp(ptr, str, length); 08275 }
Here is the call graph for this function:

Reimplemented from Field.
Definition at line 1401 of file field.h.
References Field::cmp_binary().
01402 { return cmp_binary((char *) a, (char *) b); }
Here is the call graph for this function:

| uint32 Field_bit::key_length | ( | ) | const [inline, virtual] |
Reimplemented from Field.
Definition at line 1382 of file field.h.
References Field::field_length.
01382 { return (uint32) (field_length + 7) / 8; }
| enum ha_base_keytype Field_bit::key_type | ( | ) | const [inline, virtual] |
Reimplemented from Field.
Reimplemented in Field_bit_as_char.
Definition at line 1381 of file field.h.
References HA_KEYTYPE_BIT.
01381 { return HA_KEYTYPE_BIT; }
| uint32 Field_bit::max_length | ( | ) | [inline, virtual] |
Implements Field.
Definition at line 1383 of file field.h.
References Field::field_length.
01383 { return field_length; }
| void Field_bit::move_field_offset | ( | my_ptrdiff_t | ptr_diff | ) | [inline, virtual] |
Reimplemented from Field.
Definition at line 1430 of file field.h.
References ADD_TO_PTR, bit_ptr, and Field::move_field_offset().
01431 { 01432 Field::move_field_offset(ptr_diff); 01433 bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*); 01434 }
Here is the call graph for this function:

| Field * Field_bit::new_key_field | ( | MEM_ROOT * | root, | |
| struct st_table * | new_table, | |||
| char * | new_ptr, | |||
| uchar * | new_null_ptr, | |||
| uint | new_null_bit | |||
| ) | [virtual] |
Reimplemented from Field.
Definition at line 8089 of file field.cc.
References bit_len, bit_ofs, bit_ptr, Field::new_key_field(), and Field::ptr.
08093 { 08094 Field_bit *res; 08095 if ((res= (Field_bit*) Field::new_key_field(root, new_table, 08096 new_ptr, new_null_ptr, 08097 new_null_bit))) 08098 { 08099 /* Move bits normally stored in null_pointer to new_ptr */ 08100 res->bit_ptr= (uchar*) new_ptr; 08101 res->bit_ofs= 0; 08102 if (bit_len) 08103 res->ptr++; // Store rest of data here 08104 } 08105 return res; 08106 }
Here is the call graph for this function:

Reimplemented from Field.
Definition at line 8313 of file field.cc.
References bit_len, bit_ofs, bit_ptr, bytes_in_rec, DBUG_ASSERT, get_rec_bits, memcpy, and min.
08314 { 08315 DBUG_ASSERT(max_length); 08316 uint length; 08317 if (bit_len) 08318 { 08319 uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len); 08320 *to++= bits; 08321 } 08322 length= min(bytes_in_rec, max_length - (bit_len > 0)); 08323 memcpy(to, from, length); 08324 return to + length; 08325 }
| uint32 Field_bit::pack_length | ( | ) | const [inline, virtual] |
Reimplemented from Field.
Definition at line 1410 of file field.h.
References Field::field_length.
01410 { return (uint32) (field_length + 7) / 8; }
| uint32 Field_bit::pack_length_in_rec | ( | ) | const [inline, virtual] |
Reimplemented from Field.
Definition at line 1411 of file field.h.
References bytes_in_rec.
Referenced by key_restore().
01411 { return bytes_in_rec; }
Here is the caller graph for this function:

| void Field_bit::reset | ( | void | ) | [inline, virtual] |
Reimplemented from Field.
Definition at line 1386 of file field.h.
References bytes_in_rec, bzero, and Field::ptr.
01386 { bzero(ptr, bytes_in_rec); }
| Item_result Field_bit::result_type | ( | ) | const [inline, virtual] |
Implements Field.
Definition at line 1385 of file field.h.
References INT_RESULT.
01385 { return INT_RESULT; }
| void Field_bit::set_key_image | ( | char * | buff, | |
| uint | length | |||
| ) | [inline, virtual] |
Reimplemented from Field.
Definition at line 1406 of file field.h.
References my_charset_bin, and store().
01407 { Field_bit::store(buff, length, &my_charset_bin); }
Here is the call graph for this function:

| uint Field_bit::size_of | ( | ) | const [inline, virtual] |
| void Field_bit::sort_string | ( | char * | buff, | |
| uint | length | |||
| ) | [inline, virtual] |
Implements Field.
Definition at line 1408 of file field.h.
References get_key_image(), and Field::itRAW.
01409 { get_key_image(buff, length, itRAW); }
Here is the call graph for this function:

| void Field_bit::sql_type | ( | String & | str | ) | const [virtual] |
Implements Field.
Reimplemented in Field_bit_as_char.
Definition at line 8304 of file field.cc.
References String::alloced_length(), String::charset(), charset_info_st::cset, Field::field_length, int(), String::length(), String::ptr(), and my_charset_handler_st::snprintf.
08305 { 08306 CHARSET_INFO *cs= res.charset(); 08307 ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(), 08308 "bit(%d)", (int) field_length); 08309 res.length((uint) length); 08310 }
Here is the call graph for this function:

Implements Field.
Reimplemented in Field_bit_as_char.
Definition at line 8162 of file field.cc.
References buf, mi_int8store, NULL, and store().
08163 { 08164 char buf[8]; 08165 08166 mi_int8store(buf, nr); 08167 return store(buf, 8, NULL); 08168 }
Here is the call graph for this function:

| int Field_bit::store | ( | double | nr | ) | [virtual] |
Implements Field.
Reimplemented in Field_bit_as_char.
Definition at line 8156 of file field.cc.
References FALSE, and store().
08157 { 08158 return Field_bit::store((longlong) nr, FALSE); 08159 }
Here is the call graph for this function:

| int Field_bit::store | ( | const char * | to, | |
| uint | length, | |||
| CHARSET_INFO * | charset | |||
| ) | [virtual] |
Implements Field.
Reimplemented in Field_bit_as_char.
Definition at line 8109 of file field.cc.
References ASSERT_COLUMN_MARKED_FOR_WRITE, bit_len, bit_ofs, bit_ptr, bytes_in_rec, bzero, clr_rec_bits, ER_DATA_TOO_LONG, st_table::in_use, memcpy, memset, set_rec_bits, Field::set_warning(), Field::table, MYSQL_ERROR::WARN_LEVEL_ERROR, and MYSQL_ERROR::WARN_LEVEL_WARN.
Referenced by set_key_image(), Field_bit_as_char::store(), store(), and store_decimal().
08110 { 08111 ASSERT_COLUMN_MARKED_FOR_WRITE; 08112 int delta; 08113 08114 for (; length && !*from; from++, length--); // skip left 0's 08115 delta= bytes_in_rec - length; 08116 08117 if (delta < -1 || 08118 (delta == -1 && (uchar) *from > ((1 << bit_len) - 1)) || 08119 (!bit_len && delta < 0)) 08120 { 08121 set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len); 08122 memset(ptr, 0xff, bytes_in_rec); 08123 if (table->in_use->really_abort_on_warning()) 08124 set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1); 08125 else 08126 set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); 08127 return 1; 08128 } 08129 /* delta is >= -1 here */ 08130 if (delta > 0) 08131 { 08132 if (bit_len) 08133 clr_rec_bits(bit_ptr, bit_ofs, bit_len); 08134 bzero(ptr, delta); 08135 memcpy(ptr + delta, from, length); 08136 } 08137 else if (delta == 0) 08138 { 08139 if (bit_len) 08140 clr_rec_bits(bit_ptr, bit_ofs, bit_len); 08141 memcpy(ptr, from, length); 08142 } 08143 else 08144 { 08145 if (bit_len) 08146 { 08147 set_rec_bits((uchar) *from, bit_ptr, bit_ofs, bit_len); 08148 from++; 08149 } 08150 memcpy(ptr, from, bytes_in_rec); 08151 } 08152 return 0; 08153 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Field_bit::store_decimal | ( | const my_decimal * | ) | [virtual] |
Implements Field.
Definition at line 8171 of file field.cc.
References Field::convert_decimal2longlong(), err, store(), test, and TRUE.
08172 { 08173 int err= 0; 08174 longlong i= convert_decimal2longlong(val, 1, &err); 08175 return test(err | store(i, TRUE)); 08176 }
Here is the call graph for this function:

| virtual bool Field_bit::str_needs_quotes | ( | ) | [inline, virtual] |
| enum_field_types Field_bit::type | ( | ) | const [inline, virtual] |
Implements Field.
Definition at line 1380 of file field.h.
References FIELD_TYPE_BIT.
Referenced by eq().
01380 { return FIELD_TYPE_BIT; }
Here is the caller graph for this function:

| const char * Field_bit::unpack | ( | char * | to, | |
| const char * | from | |||
| ) | [virtual] |
Reimplemented from Field.
Definition at line 8328 of file field.cc.
References bit_len, bit_ofs, bit_ptr, bytes_in_rec, memcpy, and set_rec_bits.
08329 { 08330 if (bit_len) 08331 { 08332 set_rec_bits(*from, bit_ptr, bit_ofs, bit_len); 08333 from++; 08334 } 08335 memcpy(to, from, bytes_in_rec); 08336 return from + bytes_in_rec; 08337 }
| my_decimal * Field_bit::val_decimal | ( | my_decimal * | ) | [virtual] |
Reimplemented from Field.
Definition at line 8226 of file field.cc.
References ASSERT_COLUMN_MARKED_FOR_READ, E_DEC_FATAL_ERROR, int2my_decimal(), and val_int().
08227 { 08228 ASSERT_COLUMN_MARKED_FOR_READ; 08229 int2my_decimal(E_DEC_FATAL_ERROR, val_int(), 1, deciaml_value); 08230 return deciaml_value; 08231 }
Here is the call graph for this function:

| longlong Field_bit::val_int | ( | void | ) | [virtual] |
Implements Field.
Definition at line 8185 of file field.cc.
References ASSERT_COLUMN_MARKED_FOR_READ, bit_len, bit_ofs, bit_ptr, bytes_in_rec, get_rec_bits, mi_uint2korr, mi_uint3korr, mi_uint4korr, mi_uint5korr, mi_uint6korr, mi_uint7korr, and mi_uint8korr.
Referenced by val_decimal(), and val_real().
08186 { 08187 ASSERT_COLUMN_MARKED_FOR_READ; 08188 ulonglong bits= 0; 08189 if (bit_len) 08190 { 08191 bits= get_rec_bits(bit_ptr, bit_ofs, bit_len); 08192 bits<<= (bytes_in_rec * 8); 08193 } 08194 08195 switch (bytes_in_rec) { 08196 case 0: return bits; 08197 case 1: return bits | (ulonglong) (uchar) ptr[0]; 08198 case 2: return bits | mi_uint2korr(ptr); 08199 case 3: return bits | mi_uint3korr(ptr); 08200 case 4: return bits | mi_uint4korr(ptr); 08201 case 5: return bits | mi_uint5korr(ptr); 08202 case 6: return bits | mi_uint6korr(ptr); 08203 case 7: return bits | mi_uint7korr(ptr); 08204 default: return mi_uint8korr(ptr + bytes_in_rec - sizeof(longlong)); 08205 } 08206 }
Here is the caller graph for this function:

| double Field_bit::val_real | ( | void | ) | [virtual] |
Implements Field.
Definition at line 8179 of file field.cc.
References val_int().
08180 { 08181 return (double) Field_bit::val_int(); 08182 }
Here is the call graph for this function:

Definition at line 1375 of file field.h.
Referenced by cmp_max(), cmp_offset(), Field_bit_as_char::Field_bit_as_char(), get_key_image(), key_cmp(), key_copy(), key_restore(), new_key_field(), pack(), store(), unpack(), and val_int().
Definition at line 1374 of file field.h.
Referenced by cmp_max(), cmp_offset(), eq(), get_key_image(), key_cmp(), key_copy(), key_restore(), new_key_field(), pack(), set_bit_ptr(), store(), unpack(), and val_int().
Definition at line 1373 of file field.h.
Referenced by cmp_max(), cmp_offset(), eq(), get_key_image(), key_cmp(), move_field_offset(), new_key_field(), pack(), set_bit_ptr(), store(), unpack(), and val_int().
Definition at line 1376 of file field.h.
Referenced by cmp_offset(), Field_bit_as_char::Field_bit_as_char(), get_key_image(), pack(), pack_length_in_rec(), reset(), Field_bit_as_char::store(), store(), unpack(), and val_int().
1.4.7

