Below is the list of changes that have just been committed into a local
5.1 repository of monty. When monty 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@stripped, 2007-05-02 12:11:59+03:00, monty@stripped +6 -0
Merge nosik:/my/mysql-5.1
into mysql.com:/home/my/mysql-5.1
MERGE: 1.2469.203.1
sql/field.cc@stripped, 2007-05-02 12:11:56+03:00, monty@stripped +0 -0
Auto merged
MERGE: 1.385.1.2
sql/item.cc@stripped, 2007-05-02 12:11:56+03:00, monty@stripped +0 -0
Auto merged
MERGE: 1.263.1.2
sql/item_func.cc@stripped, 2007-05-02 12:11:56+03:00, monty@stripped +0 -0
Auto merged
MERGE: 1.377.3.1
sql/item_func.h@stripped, 2007-05-02 12:11:56+03:00, monty@stripped +0 -0
Auto merged
MERGE: 1.165.1.4
sql/mysql_priv.h@stripped, 2007-05-02 12:11:56+03:00, monty@stripped +0 -0
Auto merged
MERGE: 1.497.1.3
sql/mysqld.cc@stripped, 2007-05-02 12:11:56+03:00, monty@stripped +0 -0
Auto merged
MERGE: 1.631.3.1
# 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: monty
# Host: narttu.mysql.fi
# Root: /home/my/mysql-5.1/RESYNC
--- 1.386/sql/field.cc 2007-04-27 01:12:06 +03:00
+++ 1.387/sql/field.cc 2007-05-02 12:11:56 +03:00
@@ -6099,13 +6099,21 @@ uint Field::is_equal(create_field *new_f
}
+/* If one of the fields is binary and the other one isn't return 1 else 0 */
+
+bool Field_str::compare_str_field_flags(create_field *new_field, uint32 flags)
+{
+ return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
+ !(flags & (BINCMP_FLAG | BINARY_FLAG))) ||
+ (!(new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
+ (flags & (BINCMP_FLAG | BINARY_FLAG))));
+}
+
+
uint Field_str::is_equal(create_field *new_field)
{
- if (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
- !(flags & (BINCMP_FLAG | BINARY_FLAG))) ||
- (!(new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
- (flags & (BINCMP_FLAG | BINARY_FLAG))))
- return 0; /* One of the fields is binary and the other one isn't */
+ if (compare_str_field_flags(new_field, flags))
+ return 0;
return ((new_field->sql_type == real_type()) &&
new_field->charset == field_charset &&
@@ -6400,6 +6408,15 @@ uint Field_string::max_packed_col_length
return (max_length > 255 ? 2 : 1)+max_length;
}
+uint Field_string::get_key_image(char *buff, uint length, imagetype type_arg)
+{
+ uint bytes = my_charpos(field_charset, ptr, ptr + field_length,
+ length / field_charset->mbmaxlen);
+ memcpy(buff, ptr, bytes);
+ if (bytes < length)
+ bzero(buff + bytes, length - bytes);
+ return bytes;
+}
Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
bool keep_type)
@@ -6858,9 +6875,7 @@ uint Field_varstring::max_packed_col_len
return (max_length > 255 ? 2 : 1)+max_length;
}
-
-void Field_varstring::get_key_image(char *buff, uint length,
- imagetype type_arg)
+uint Field_varstring::get_key_image(char *buff, uint length, imagetype type)
{
uint f_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
uint local_char_length= length / field_charset->mbmaxlen;
@@ -6879,6 +6894,7 @@ void Field_varstring::get_key_image(char
*/
bzero(buff+HA_KEY_BLOB_LENGTH+f_length, (length-f_length));
}
+ return HA_KEY_BLOB_LENGTH+f_length;
}
@@ -7283,7 +7299,7 @@ int Field_blob::cmp_binary(const char *a
/* The following is used only when comparing a key */
-void Field_blob::get_key_image(char *buff, uint length, imagetype type_arg)
+uint Field_blob::get_key_image(char *buff,uint length, imagetype type_arg)
{
uint32 blob_length= get_length(ptr);
char *blob;
@@ -7295,16 +7311,17 @@ void Field_blob::get_key_image(char *buf
MBR mbr;
Geometry_buffer buffer;
Geometry *gobj;
+ const uint image_length= SIZEOF_STORED_DOUBLE*4;
if (blob_length < SRID_SIZE)
{
- bzero(buff, SIZEOF_STORED_DOUBLE*4);
- return;
+ bzero(buff, image_length);
+ return image_length;
}
get_ptr(&blob);
gobj= Geometry::construct(&buffer, blob, blob_length);
if (!gobj || gobj->get_mbr(&mbr, &dummy))
- bzero(buff, SIZEOF_STORED_DOUBLE*4);
+ bzero(buff, image_length);
else
{
float8store(buff, mbr.xmin);
@@ -7312,7 +7329,7 @@ void Field_blob::get_key_image(char *buf
float8store(buff+16, mbr.ymin);
float8store(buff+24, mbr.ymax);
}
- return;
+ return image_length;
}
#endif /*HAVE_SPATIAL*/
@@ -7333,6 +7350,7 @@ void Field_blob::get_key_image(char *buf
}
int2store(buff,length);
memcpy(buff+HA_KEY_BLOB_LENGTH, blob, length);
+ return HA_KEY_BLOB_LENGTH+length;
}
@@ -7616,9 +7634,21 @@ uint Field_blob::max_packed_col_length(u
}
+uint Field_blob::is_equal(create_field *new_field)
+{
+ if (compare_str_field_flags(new_field, flags))
+ return 0;
+
+ return ((new_field->sql_type == get_blob_type_from_length(max_data_length()))
+ && new_field->charset == field_charset &&
+ ((Field_blob *)new_field->field)->max_data_length() ==
+ max_data_length());
+}
+
+
#ifdef HAVE_SPATIAL
-void Field_geom::get_key_image(char *buff, uint length, imagetype type_arg)
+uint Field_geom::get_key_image(char *buff, uint length, imagetype type)
{
char *blob;
const char *dummy;
@@ -7626,16 +7656,17 @@ void Field_geom::get_key_image(char *buf
ulong blob_length= get_length(ptr);
Geometry_buffer buffer;
Geometry *gobj;
+ const uint image_length= SIZEOF_STORED_DOUBLE*4;
if (blob_length < SRID_SIZE)
{
- bzero(buff, SIZEOF_STORED_DOUBLE*4);
- return;
+ bzero(buff, image_length);
+ return image_length;
}
get_ptr(&blob);
gobj= Geometry::construct(&buffer, blob, blob_length);
if (!gobj || gobj->get_mbr(&mbr, &dummy))
- bzero(buff, SIZEOF_STORED_DOUBLE*4);
+ bzero(buff, image_length);
else
{
float8store(buff, mbr.xmin);
@@ -7643,6 +7674,7 @@ void Field_geom::get_key_image(char *buf
float8store(buff + 16, mbr.ymin);
float8store(buff + 24, mbr.ymax);
}
+ return image_length;
}
@@ -8426,7 +8458,7 @@ int Field_bit::cmp_offset(uint row_offse
}
-void Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
+uint Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
{
if (bit_len)
{
@@ -8434,7 +8466,9 @@ void Field_bit::get_key_image(char *buff
*buff++= bits;
length--;
}
- memcpy(buff, ptr, min(length, bytes_in_rec));
+ uint data_length = min(length, bytes_in_rec);
+ memcpy(buff, ptr, data_length);
+ return data_length + 1;
}
--- 1.266/sql/item.cc 2007-04-29 16:47:35 +03:00
+++ 1.267/sql/item.cc 2007-05-02 12:11:56 +03:00
@@ -161,6 +161,7 @@ Hybrid_type_traits_integer::fix_length_a
void item_init(void)
{
item_user_lock_init();
+ uuid_short_init();
}
--- 1.383/sql/item_func.cc 2007-04-28 22:27:19 +03:00
+++ 1.384/sql/item_func.cc 2007-05-02 12:11:56 +03:00
@@ -5399,3 +5399,40 @@ Item_func_sp::fix_fields(THD *thd, Item
}
DBUG_RETURN(res);
}
+
+
+/*
+ uuid_short handling.
+
+ The short uuid is defined as a longlong that contains the following bytes:
+
+ Bytes Comment
+ 1 Server_id & 255
+ 4 Startup time of server in seconds
+ 3 Incrementor
+
+ This means that an uuid is guaranteed to be unique
+ even in a replication environment if the following holds:
+
+ - The last byte of the server id is unique
+ - If you between two shutdown of the server don't get more than
+ an average of 2^24 = 16M calls to uuid_short() per second.
+*/
+
+ulonglong uuid_value;
+
+void uuid_short_init()
+{
+ uuid_value= (((ulonglong) server_id << 56) +
+ (ulonglong) server_start_time << 24);
+}
+
+
+longlong Item_func_uuid_short::val_int()
+{
+ ulonglong val;
+ pthread_mutex_lock(&LOCK_uuid_generator);
+ val= uuid_value++;
+ pthread_mutex_unlock(&LOCK_uuid_generator);
+ return (longlong) val;
+}
--- 1.166/sql/item_func.h 2007-04-27 01:12:06 +03:00
+++ 1.167/sql/item_func.h 2007-05-02 12:11:56 +03:00
@@ -280,7 +280,7 @@ public:
{ max_length= 21; }
Item_int_func(List<Item> &list) :Item_func(list) { max_length= 21; }
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {}
- double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
+ double val_real();
String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() {}
@@ -305,12 +305,6 @@ class Item_func_signed :public Item_int_
public:
Item_func_signed(Item *a) :Item_int_func(a) {}
const char *func_name() const { return "cast_as_signed"; }
- double val_real()
- {
- double tmp= args[0]->val_real();
- null_value= args[0]->null_value;
- return tmp;
- }
longlong val_int();
longlong val_int_from_str(int *error);
void fix_length_and_dec()
@@ -738,6 +732,35 @@ class Item_func_max :public Item_func_mi
public:
Item_func_max(List<Item> &list) :Item_func_min_max(list,-1) {}
const char *func_name() const { return "greatest"; }
+};
+
+
+/*
+ Objects of this class are used for ROLLUP queries to wrap up
+ each constant item referred to in GROUP BY list.
+*/
+
+class Item_func_rollup_const :public Item_func
+{
+public:
+ Item_func_rollup_const(Item *a) :Item_func(a)
+ {
+ name= a->name;
+ name_length= a->name_length;
+ }
+ double val_real() { return args[0]->val_real(); }
+ longlong val_int() { return args[0]->val_int(); }
+ String *val_str(String *str) { return args[0]->val_str(str); }
+ my_decimal *val_decimal(my_decimal *dec) { return args[0]->val_decimal(dec); }
+ const char *func_name() const { return "rollup_const"; }
+ bool const_item() const { return 0; }
+ Item_result result_type() const { return args[0]->result_type(); }
+ void fix_length_and_dec()
+ {
+ collation= args[0]->collation;
+ max_length= args[0]->max_length;
+ decimals=args[0]->decimals;
+ }
};
--- 1.503/sql/mysql_priv.h 2007-04-28 22:20:14 +03:00
+++ 1.504/sql/mysql_priv.h 2007-05-02 12:11:56 +03:00
@@ -399,6 +399,8 @@ MY_LOCALE *my_locale_by_number(uint numb
#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
#define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2)
+#define MODE_PAD_CHAR_TO_FULL_LENGTH (MODE_NO_ENGINE_SUBSTITUTION*2)
+
/*
Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
use strictly more than 64 bits by adding one more define above, you should
--- 1.638/sql/mysqld.cc 2007-04-26 17:02:53 +03:00
+++ 1.639/sql/mysqld.cc 2007-05-02 12:11:56 +03:00
@@ -225,8 +225,10 @@ static const char *sql_mode_names[]=
"ERROR_FOR_DIVISION_BY_ZERO",
"TRADITIONAL", "NO_AUTO_CREATE_USER", "HIGH_NOT_PRECEDENCE",
"NO_ENGINE_SUBSTITUTION",
+ "PAD_CHAR_TO_FULL_LENGTH",
NullS
};
+
static const unsigned int sql_mode_names_len[]=
{
/*REAL_AS_FLOAT*/ 13,
@@ -259,8 +261,10 @@ static const unsigned int sql_mode_names
/*TRADITIONAL*/ 11,
/*NO_AUTO_CREATE_USER*/ 19,
/*HIGH_NOT_PRECEDENCE*/ 19,
- /*NO_ENGINE_SUBSTITUTION*/ 22
+ /*NO_ENGINE_SUBSTITUTION*/ 22,
+ /*PAD_CHAR_TO_FULL_LENGTH*/ 23
};
+
TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"",
sql_mode_names,
(unsigned int *)sql_mode_names_len };
| Thread |
|---|
| • bk commit into 5.1 tree (monty:1.2503) | monty | 2 May |