Below is the list of changes that have just been committed into a local
5.1 repository of marty. When marty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2321 06/04/11 14:26:06 mskold@stripped +1 -0
Merge mskold@stripped:/home/bk/mysql-5.1-new
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-new
sql/field.cc
1.310 06/04/11 14:25:58 mskold@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mskold
# Host: blowfish.ndb.mysql.com
# Root: /usr/local/home/marty/MySQL/mysql-5.1-new/RESYNC
--- 1.309/sql/field.cc 2006-04-06 11:25:21 +02:00
+++ 1.310/sql/field.cc 2006-04-11 14:25:58 +02:00
@@ -7998,9 +7998,10 @@
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)
- : Field(ptr_arg, len_arg >> 3, null_ptr_arg, null_bit_arg,
+ : Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg),
- bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7)
+ bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7),
+ bytes_in_rec(len_arg / 8)
{
/*
Ensure that Field::eq() can distinguish between two different bit fields.
@@ -8036,14 +8037,14 @@
int delta;
for (; length && !*from; from++, length--); // skip left 0's
- delta= field_length - length;
+ delta= bytes_in_rec - length;
if (delta < -1 ||
(delta == -1 && (uchar) *from > ((1 << bit_len) - 1)) ||
(!bit_len && delta < 0))
{
set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len);
- memset(ptr, 0xff, field_length);
+ memset(ptr, 0xff, bytes_in_rec);
if (table->in_use->really_abort_on_warning())
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
else
@@ -8071,7 +8072,7 @@
set_rec_bits((uchar) *from, bit_ptr, bit_ofs, bit_len);
from++;
}
- memcpy(ptr, from, field_length);
+ memcpy(ptr, from, bytes_in_rec);
}
return 0;
}
@@ -8112,10 +8113,10 @@
if (bit_len)
{
bits= get_rec_bits(bit_ptr, bit_ofs, bit_len);
- bits<<= (field_length * 8);
+ bits<<= (bytes_in_rec * 8);
}
- switch (field_length) {
+ switch (bytes_in_rec) {
case 0: return bits;
case 1: return bits | (ulonglong) (uchar) ptr[0];
case 2: return bits | mi_uint2korr(ptr);
@@ -8124,7 +8125,7 @@
case 5: return bits | mi_uint5korr(ptr);
case 6: return bits | mi_uint6korr(ptr);
case 7: return bits | mi_uint7korr(ptr);
- default: return mi_uint8korr(ptr + field_length - sizeof(longlong));
+ default: return mi_uint8korr(ptr + bytes_in_rec - sizeof(longlong));
}
}
@@ -8206,7 +8207,7 @@
if ((flag= (int) (bits_a - bits_b)))
return flag;
}
- return memcmp(ptr, ptr + row_offset, field_length);
+ return memcmp(ptr, ptr + row_offset, bytes_in_rec);
}
@@ -8218,7 +8219,7 @@
*buff++= bits;
length--;
}
- memcpy(buff, ptr, min(length, field_length));
+ memcpy(buff, ptr, min(length, bytes_in_rec));
}
@@ -8226,22 +8227,22 @@
{
CHARSET_INFO *cs= res.charset();
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
- "bit(%d)",
- (int) field_length * 8 + bit_len);
+ "bit(%d)", (int) field_length);
res.length((uint) length);
}
char *Field_bit::pack(char *to, const char *from, uint max_length)
{
- uint length= min(field_length + (bit_len > 0), max_length);
+ DBUG_ASSERT(max_length);
+ uint length;
if (bit_len)
{
uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len);
*to++= bits;
- length--;
}
- memcpy(to, from, length);
+ length= min(bytes_in_rec, max_length - (bit_len > 0));
+ memcpy(to, from, length);
return to + length;
}
@@ -8253,8 +8254,8 @@
set_rec_bits(*from, bit_ptr, bit_ofs, bit_len);
from++;
}
- memcpy(to, from, field_length);
- return from + field_length;
+ memcpy(to, from, bytes_in_rec);
+ return from + bytes_in_rec;
}
@@ -8267,26 +8268,25 @@
enum utype unireg_check_arg,
const char *field_name_arg)
:Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0, 0,
- unireg_check_arg, field_name_arg),
- create_length(len_arg)
+ unireg_check_arg, field_name_arg)
{
bit_len= 0;
- field_length= ((len_arg + 7) & ~7) / 8;
+ bytes_in_rec= (len_arg + 7) / 8;
}
int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
{
int delta;
- uchar bits= create_length & 7;
+ uchar bits= field_length & 7;
for (; length && !*from; from++, length--); // skip left 0's
- delta= field_length - length;
+ delta= bytes_in_rec - length;
if (delta < 0 ||
(delta == 0 && bits && (uint) (uchar) *from >= (uint) (1 << bits)))
{
- memset(ptr, 0xff, field_length);
+ memset(ptr, 0xff, bytes_in_rec);
if (bits)
*ptr&= ((1 << bits) - 1); /* set first byte */
if (table->in_use->really_abort_on_warning())
@@ -8305,7 +8305,7 @@
{
CHARSET_INFO *cs= res.charset();
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
- "bit(%d)", (int) create_length);
+ "bit(%d)", (int) field_length);
res.length((uint) length);
}
@@ -9033,11 +9033,6 @@
geom_type= ((Field_geom*)old_field)->geom_type;
break;
#endif
- case FIELD_TYPE_BIT:
- length= (old_field->key_type() == HA_KEYTYPE_BIT) ?
- ((Field_bit *) old_field)->bit_len + length * 8 :
- ((Field_bit_as_char *) old_field)->create_length;
- break;
default:
break;
}
| Thread |
|---|
| • bk commit into 5.1 tree (mskold:1.2321) | Martin Skold | 11 Apr |