Below is the list of changes that have just been committed into a local
5.1 repository of knielsen. When knielsen 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.2114 06/01/31 22:50:18 knielsen@stripped +76 -0
Merge mysql.com:/usr/local/mysql/tmp_merge
into mysql.com:/usr/local/mysql/tmp_merge2
tests/mysql_client_test.c
1.170 06/01/31 22:50:13 knielsen@stripped +1 -3
Manual merge.
storage/innobase/lock/lock0lock.c
1.65 06/01/31 22:50:13 knielsen@stripped +17 -58
Manual merge.
sql/sql_yacc.yy
1.448 06/01/31 22:50:13 knielsen@stripped +4 -1
Manual merge.
sql/sql_repl.cc
1.149 06/01/31 22:50:13 knielsen@stripped +3 -3
Manual merge.
sql/sql_insert.cc
1.186 06/01/31 22:50:13 knielsen@stripped +1 -3
Manual merge.
sql/set_var.cc
1.163 06/01/31 22:50:13 knielsen@stripped +1 -2
Manual merge.
sql/item_func.cc
1.272 06/01/31 22:50:13 knielsen@stripped +0 -1
Manual merge.
sql/item.cc
1.165 06/01/31 22:50:13 knielsen@stripped +1 -2
Manual merge.
sql/ha_innodb.cc
1.252 06/01/31 22:50:13 knielsen@stripped +0 -5
Manual merge.
sql/field.cc
1.298 06/01/31 22:50:13 knielsen@stripped +5 -9
Manual merge.
mysys/my_bitmap.c
1.37 06/01/31 22:50:13 knielsen@stripped +1 -2
Manual merge.
mysql-test/t/alter_table.test
1.46 06/01/31 22:50:13 knielsen@stripped +7 -10
Manual merge.
mysql-test/r/alter_table.result
1.59 06/01/31 22:50:13 knielsen@stripped +3 -4
Manual merge.
mysql-test/mysql-test-run.pl
1.59 06/01/31 22:50:13 knielsen@stripped +0 -0
Manual merge.
storage/myisam/sort.c
1.51 06/01/31 22:13:17 knielsen@stripped +0 -0
Auto merged
storage/myisam/myisampack.c
1.52 06/01/31 22:13:17 knielsen@stripped +0 -0
Auto merged
storage/myisam/mi_delete.c
1.39 06/01/31 22:13:17 knielsen@stripped +0 -0
Auto merged
storage/innobase/trx/trx0trx.c
1.62 06/01/31 22:13:17 knielsen@stripped +0 -0
Auto merged
storage/innobase/srv/srv0srv.c
1.96 06/01/31 22:13:17 knielsen@stripped +0 -0
Auto merged
storage/innobase/row/row0sel.c
1.100 06/01/31 22:13:17 knielsen@stripped +0 -1
Auto merged
storage/innobase/row/row0mysql.c
1.120 06/01/31 22:13:17 knielsen@stripped +0 -2
Auto merged
storage/innobase/row/row0ins.c
1.75 06/01/31 22:13:17 knielsen@stripped +0 -0
Auto merged
storage/innobase/os/os0file.c
1.113 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
storage/innobase/include/srv0srv.h
1.59 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
storage/innobase/include/row0mysql.h
1.46 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
storage/innobase/include/os0file.h
1.44 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
storage/innobase/include/lock0lock.h
1.26 06/01/31 22:13:16 knielsen@stripped +0 -12
Auto merged
storage/innobase/include/data0type.ic
1.28 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
storage/innobase/include/data0type.h
1.23 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
sql/table.cc
1.205 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
sql/share/errmsg.txt
1.78 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
sql-common/client.c
1.83 06/01/31 22:13:16 knielsen@stripped +0 -0
Auto merged
sql/sql_test.cc
1.45 06/01/31 22:13:15 knielsen@stripped +0 -0
Auto merged
sql/sql_table.cc
1.302 06/01/31 22:13:15 knielsen@stripped +0 -0
Auto merged
sql/sql_show.cc
1.296 06/01/31 22:13:15 knielsen@stripped +0 -0
Auto merged
sql/sql_parse.cc
1.516 06/01/31 22:13:15 knielsen@stripped +0 -0
Auto merged
sql/sql_help.cc
1.52 06/01/31 22:13:15 knielsen@stripped +0 -0
Auto merged
sql/sql_handler.cc
1.80 06/01/31 22:13:15 knielsen@stripped +0 -0
Auto merged
sql/sql_db.cc
1.126 06/01/31 22:13:15 knielsen@stripped +0 -0
Auto merged
sql/sql_acl.cc
1.176 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/sp_head.h
1.76 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/sp_head.cc
1.196 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/slave.h
1.94 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/slave.cc
1.263 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/repl_failsafe.cc
1.63 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/opt_range.h
1.60 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/opt_range.cc
1.199 06/01/31 22:13:14 knielsen@stripped +0 -0
Auto merged
sql/mysqld.cc
1.528 06/01/31 22:13:13 knielsen@stripped +0 -0
Auto merged
sql/log_event.cc
1.202 06/01/31 22:13:13 knielsen@stripped +0 -0
Auto merged
sql/ha_myisam.cc
1.171 06/01/31 22:13:13 knielsen@stripped +0 -0
Auto merged
sql/ha_innodb.h
1.116 06/01/31 22:13:13 knielsen@stripped +0 -0
Auto merged
sql/ha_berkeley.cc
1.169 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
sql/field.h
1.176 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/t/sp.test
1.171 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/t/ps.test
1.59 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/t/mysqltest.test
1.33 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/t/innodb.test
1.125 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/t/ctype_ucs.test
1.38 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/t/create.test
1.76 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/view_grant.result
1.11 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/variables.result
1.78 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/type_decimal.result
1.40 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/sp.result
1.181 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/sp-error.result
1.100 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/ps.result
1.60 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/mysqltest.result
1.29 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/innodb.result
1.156 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
mysql-test/r/ctype_ucs.result
1.42 06/01/31 22:13:12 knielsen@stripped +0 -0
Auto merged
storage/innobase/row/row0ins.c
1.65.10.2 06/01/31 22:13:11 knielsen@stripped +0 -0
Merge rename: innobase/row/row0ins.c -> storage/innobase/row/row0ins.c
storage/innobase/os/os0file.c
1.103.7.3 06/01/31 22:13:11 knielsen@stripped +0 -0
Merge rename: innobase/os/os0file.c -> storage/innobase/os/os0file.c
storage/innobase/lock/lock0lock.c
1.55.7.2 06/01/31 22:13:11 knielsen@stripped +0 -0
Merge rename: innobase/lock/lock0lock.c -> storage/innobase/lock/lock0lock.c
storage/innobase/include/srv0srv.h
1.51.7.3 06/01/31 22:13:11 knielsen@stripped +0 -0
Merge rename: innobase/include/srv0srv.h -> storage/innobase/include/srv0srv.h
storage/innobase/include/row0mysql.h
1.39.5.2 06/01/31 22:13:11 knielsen@stripped +0 -0
Merge rename: innobase/include/row0mysql.h -> storage/innobase/include/row0mysql.h
storage/innobase/include/os0file.h
1.34.7.3 06/01/31 22:13:11 knielsen@stripped +0 -0
Merge rename: innobase/include/os0file.h -> storage/innobase/include/os0file.h
mysql-test/r/create.result
1.114 06/01/31 22:13:11 knielsen@stripped +0 -0
Auto merged
libmysql/libmysql.c
1.233 06/01/31 22:13:11 knielsen@stripped +0 -0
Auto merged
include/my_base.h
1.82 06/01/31 22:13:11 knielsen@stripped +0 -0
Auto merged
configure.in
1.334 06/01/31 22:13:11 knielsen@stripped +0 -0
Auto merged
client/mysqltest.c
1.177 06/01/31 22:13:11 knielsen@stripped +0 -0
Auto merged
client/mysqldump.c
1.221 06/01/31 22:13:11 knielsen@stripped +0 -0
Auto merged
client/mysqlbinlog.cc
1.127 06/01/31 22:13:11 knielsen@stripped +0 -0
Auto merged
storage/myisam/sort.c
1.45.5.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: myisam/sort.c -> storage/myisam/sort.c
storage/myisam/myisampack.c
1.39.13.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: myisam/myisampack.c -> storage/myisam/myisampack.c
storage/myisam/mi_delete.c
1.33.6.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: myisam/mi_delete.c -> storage/myisam/mi_delete.c
storage/innobase/trx/trx0trx.c
1.54.8.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: innobase/trx/trx0trx.c -> storage/innobase/trx/trx0trx.c
storage/innobase/srv/srv0srv.c
1.87.9.3 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: innobase/srv/srv0srv.c -> storage/innobase/srv/srv0srv.c
storage/innobase/row/row0sel.c
1.92.5.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: innobase/row/row0sel.c -> storage/innobase/row/row0sel.c
storage/innobase/row/row0mysql.c
1.103.12.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: innobase/row/row0mysql.c -> storage/innobase/row/row0mysql.c
storage/innobase/include/lock0lock.h
1.21.3.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: innobase/include/lock0lock.h -> storage/innobase/include/lock0lock.h
storage/innobase/include/data0type.ic
1.24.3.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: innobase/include/data0type.ic -> storage/innobase/include/data0type.ic
storage/innobase/include/data0type.h
1.20.2.2 06/01/31 22:13:10 knielsen@stripped +0 -0
Merge rename: innobase/include/data0type.h -> storage/innobase/include/data0type.h
BitKeeper/etc/ignore
1.225 06/01/31 22:13:02 knielsen@stripped +1 -142
auto-union
# 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: knielsen
# Host: rt.int.sifira.dk
# Root: /usr/local/mysql/tmp_merge2/RESYNC
--- 1.220/client/mysqldump.c 2006-01-13 17:04:31 +01:00
+++ 1.221/client/mysqldump.c 2006-01-31 22:13:11 +01:00
@@ -1311,7 +1311,7 @@
fprintf(sql_file, "DELIMITER ;\n");
if (lock_tables)
- mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
+ VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
DBUG_RETURN(0);
}
@@ -2134,7 +2134,10 @@
else
res=mysql_store_result(sock);
if (!res)
+ {
DB_error(sock, "when retrieving data from server");
+ goto err;
+ }
if (verbose)
fprintf(stderr, "-- Retrieving rows...\n");
if (mysql_num_fields(res) != num_fields)
@@ -2664,7 +2667,7 @@
check_io(md_result_file);
}
if (lock_tables)
- mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
+ VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
return 0;
} /* dump_all_tables_in_db */
@@ -2719,23 +2722,23 @@
check_io(md_result_file);
}
if (lock_tables)
- mysql_query(sock,"UNLOCK TABLES");
+ VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
return 0;
} /* dump_all_tables_in_db */
/*
- get_actual_table_name -- executes a SHOW TABLES LIKE '%s' to get the actual
- table name from the server for the table name given on the command line.
- we do this because the table name given on the command line may be a
+ get_actual_table_name -- executes a SHOW TABLES LIKE '%s' to get the actual
+ table name from the server for the table name given on the command line.
+ we do this because the table name given on the command line may be a
different case (e.g. T1 vs t1)
-
+
RETURN
int - 0 if a tablename was retrieved. 1 if not
*/
-static int get_actual_table_name(const char *old_table_name,
- char *new_table_name,
+static int get_actual_table_name(const char *old_table_name,
+ char *new_table_name,
int buf_size)
{
int retval;
@@ -2747,7 +2750,7 @@
/* Check memory for quote_for_like() */
DBUG_ASSERT(2*sizeof(old_table_name) < sizeof(show_name_buff));
- my_snprintf(query, sizeof(query), "SHOW TABLES LIKE %s",
+ my_snprintf(query, sizeof(query), "SHOW TABLES LIKE %s",
quote_for_like(old_table_name, show_name_buff));
if (mysql_query_with_error_report(sock, 0, query))
@@ -2756,7 +2759,7 @@
}
retval = 1;
-
+
if ((table_res= mysql_store_result(sock)))
{
my_ulonglong num_rows= mysql_num_rows(table_res);
@@ -2878,7 +2881,7 @@
check_io(md_result_file);
}
if (lock_tables)
- mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
+ VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
DBUG_RETURN(0);
} /* dump_selected_tables */
--- 1.333/configure.in 2006-01-20 16:36:57 +01:00
+++ 1.334/configure.in 2006-01-31 22:13:11 +01:00
@@ -13,7 +13,8 @@
PROTOCOL_VERSION=10
DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions.
-SHARED_LIB_VERSION=15:0:0
+SHARED_LIB_MAJOR_VERSION=15
+SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4
@@ -60,6 +61,7 @@
AC_SUBST(DOT_FRM_VERSION)
AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
[Version of .frm files])
+AC_SUBST(SHARED_LIB_MAJOR_VERSION)
AC_SUBST(SHARED_LIB_VERSION)
AC_SUBST(AVAILABLE_LANGUAGES)
@@ -338,6 +340,13 @@
fi
MYSQL_PROG_AR
+
+# libmysqlclient versioning when linked with GNU ld.
+if $LD --version 2>/dev/null|grep -q GNU; then
+ LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmysql/libmysql.ver"
+ AC_CONFIG_FILES(libmysql/libmysql.ver)
+fi
+AC_SUBST(LD_VERSION_SCRIPT)
# Avoid bug in fcntl on some versions of linux
AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")
--- 1.81/include/my_base.h 2006-01-19 03:55:59 +01:00
+++ 1.82/include/my_base.h 2006-01-31 22:13:11 +01:00
@@ -426,7 +426,8 @@
enum en_fieldtype {
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
- FIELD_VARCHAR,FIELD_CHECK
+ FIELD_VARCHAR,FIELD_CHECK,
+ FIELD_enum_val_count
};
enum data_file_type {
--- 1.232/libmysql/libmysql.c 2006-01-18 13:14:58 +01:00
+++ 1.233/libmysql/libmysql.c 2006-01-31 22:13:11 +01:00
@@ -2722,13 +2722,13 @@
/* Send row request to the server */
int4store(buff, stmt->stmt_id);
int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */
- if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
- NullS, 0, 1))
+ if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
+ buff, sizeof(buff), NullS, 0, 1))
{
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
return 1;
}
- if (cli_read_binary_rows(stmt))
+ if ((*mysql->methods->read_rows_from_cursor)(stmt))
return 1;
stmt->server_status= mysql->server_status;
@@ -5101,9 +5101,9 @@
DBUG_ENTER("mysql_autocommit");
DBUG_PRINT("enter", ("mode : %d", auto_mode));
- if (auto_mode) /* set to true */
- DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=1", 16));
- DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=0", 16));
+ DBUG_RETURN((my_bool) mysql_real_query(mysql, auto_mode ?
+ "set autocommit=1":"set autocommit=0",
+ 16));
}
--- 1.297/sql/field.cc 2006-01-16 14:26:26 +01:00
+++ 1.298/sql/field.cc 2006-01-31 22:50:13 +01:00
@@ -1565,7 +1565,6 @@
bool Field::quote_data(String *unquoted_string)
{
char escaped_string[IO_SIZE];
- char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
DBUG_ENTER("Field::quote_data");
if (!needs_quotes())
@@ -4545,8 +4544,6 @@
error= 1;
}
}
- if (error > 1)
- error= 2;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
@@ -7113,7 +7110,7 @@
}
get_ptr(&blob);
gobj= Geometry::construct(&buffer, blob, blob_length);
- if (gobj->get_mbr(&mbr, &dummy))
+ if (!gobj || gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
{
@@ -7442,7 +7439,7 @@
}
get_ptr(&blob);
gobj= Geometry::construct(&buffer, blob, blob_length);
- if (gobj->get_mbr(&mbr, &dummy))
+ if (!gobj || gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
{
@@ -8240,15 +8237,12 @@
Field_bit_as_char::Field_bit_as_char(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_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, bit_ptr_arg,
- bit_ofs_arg, unireg_check_arg, 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)
{
- bit_ptr= 0;
- bit_ofs= 0;
bit_len= 0;
field_length= ((len_arg + 7) & ~7) / 8;
}
@@ -8951,7 +8945,7 @@
case FIELD_TYPE_BIT:
return f_bit_as_char(pack_flag) ?
new Field_bit_as_char(ptr, field_length, null_pos, null_bit,
- bit_ptr, bit_offset, unireg_check, field_name) :
+ unireg_check, field_name) :
new Field_bit(ptr, field_length, null_pos, null_bit, bit_ptr,
bit_offset, unireg_check, field_name);
--- 1.175/sql/field.h 2006-01-27 17:22:59 +01:00
+++ 1.176/sql/field.h 2006-01-31 22:13:12 +01:00
@@ -1373,12 +1373,12 @@
}
};
-
+
class Field_bit_as_char: public Field_bit {
public:
uchar create_length;
Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
- uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
+ uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg);
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
uint32 max_length() { return (uint32) create_length; }
--- 1.170/sql/ha_myisam.cc 2006-01-19 22:40:51 +01:00
+++ 1.171/sql/ha_myisam.cc 2006-01-31 22:13:13 +01:00
@@ -285,7 +285,8 @@
if (fd < 0)
{
- my_net_write(net, "", 0);
+ if (my_net_write(net, "", 0))
+ error = errno ? errno : EPIPE;
net_flush(net);
}
@@ -419,12 +420,14 @@
{
uint old_testflag=param.testflag;
param.testflag|=T_MEDIUM;
- init_io_cache(¶m.read_cache, file->dfile,
- my_default_record_cache_size, READ_CACHE,
- share->pack.header_length, 1, MYF(MY_WME));
- error |= chk_data_link(¶m, file, param.testflag & T_EXTEND);
- end_io_cache(&(param.read_cache));
- param.testflag=old_testflag;
+ if (!(error= init_io_cache(¶m.read_cache, file->dfile,
+ my_default_record_cache_size, READ_CACHE,
+ share->pack.header_length, 1, MYF(MY_WME))))
+ {
+ error= chk_data_link(¶m, file, param.testflag & T_EXTEND);
+ end_io_cache(&(param.read_cache));
+ }
+ param.testflag= old_testflag;
}
}
if (!error)
--- 1.164/sql/item.cc 2006-01-06 19:34:56 +01:00
+++ 1.165/sql/item.cc 2006-01-31 22:50:13 +01:00
@@ -985,7 +985,7 @@
void Item_case_expr::print(String *str)
{
- str->append(STRING_WITH_LEN("case_expr@"));
+ VOID(str->append(STRING_WITH_LEN("case_expr@")));
str->qs_append(m_case_expr_id);
}
@@ -3868,7 +3868,7 @@
name);
break;
case MYSQL_TYPE_BIT:
- field= new Field_bit_as_char(NULL, max_length, null_ptr, 0, NULL, 0,
+ field= new Field_bit_as_char(NULL, max_length, null_ptr, 0,
Field::NONE, name);
break;
default:
--- 1.271/sql/item_func.cc 2005-12-12 20:55:12 +01:00
+++ 1.272/sql/item_func.cc 2006-01-31 22:50:13 +01:00
@@ -890,7 +890,7 @@
my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf);
if (null_value)
return NULL;
- my_decimal2string(E_DEC_FATAL_ERROR, &tmp_buf, 0, 0, 0, str);
+ my_decimal2string(E_DEC_FATAL_ERROR, tmp, 0, 0, 0, str);
return str;
}
@@ -4746,8 +4746,13 @@
if (!(f= *flp))
{
- *flp= f= sp_result_field();
- f->move_field((f->pack_length() > sizeof(result_buf)) ?
+ if (!(*flp= f= sp_result_field()))
+ {
+ my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+ return 0;
+ }
+
+ f->move_field((f->pack_length() > sizeof(result_buf)) ?
sql_alloc(f->pack_length()) : result_buf);
f->null_ptr= (uchar *)&null_value;
f->null_bit= 1;
--- 1.201/sql/log_event.cc 2006-01-26 04:54:37 +01:00
+++ 1.202/sql/log_event.cc 2006-01-31 22:13:13 +01:00
@@ -3342,6 +3342,10 @@
case INSERT_ID_EVENT:
msg="INSERT_ID";
break;
+ case INVALID_INT_EVENT:
+ default: // cannot happen
+ msg="INVALID_INT";
+ break;
}
fprintf(file, "%s=%s;\n", msg, llstr(val,llbuff));
fflush(file);
--- 1.126/client/mysqlbinlog.cc 2006-01-04 20:37:03 +01:00
+++ 1.127/client/mysqlbinlog.cc 2006-01-31 22:13:11 +01:00
@@ -1293,12 +1293,13 @@
}
else if (buf[4] == ROTATE_EVENT)
{
+ Log_event *ev;
my_b_seek(file, tmp_pos); /* seek back to event's start */
- if (!Log_event::read_log_event(file, *description_event))
+ if (!(ev= Log_event::read_log_event(file, *description_event)))
/* EOF can't be hit here normally, so it's a real error */
- die("Could not read a Rotate_log_event event \
-at offset %lu ; this could be a log format error or read error",
- tmp_pos);
+ die("Could not read a Rotate_log_event event at offset %lu ;"
+ " this could be a log format error or read error", tmp_pos);
+ delete ev;
}
else
break;
--- 1.527/sql/mysqld.cc 2006-01-30 13:31:18 +01:00
+++ 1.528/sql/mysqld.cc 2006-01-31 22:13:13 +01:00
@@ -5118,8 +5118,8 @@
(gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
"Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).",
- (gptr*) &innobase_flush_log_at_trx_commit,
- (gptr*) &innobase_flush_log_at_trx_commit,
+ (gptr*) &srv_flush_log_at_trx_commit,
+ (gptr*) &srv_flush_log_at_trx_commit,
0, GET_UINT, OPT_ARG, 1, 0, 2, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
"With which method to flush data.", (gptr*) &innobase_unix_file_flush_method,
@@ -5873,9 +5873,11 @@
(gptr*) &srv_n_spin_wait_rounds,
0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0},
{"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
- "Helps in performance tuning in heavily concurrent environments.",
+ "Helps in performance tuning in heavily concurrent environments. "
+ "Sets the maximum number of threads allowed inside InnoDB. Value 0"
+ " will disable the thread throttling.",
(gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
- 0, GET_LONG, REQUIRED_ARG, 20, 1, 1000, 0, 1, 0},
+ 0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},
{"innodb_commit_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
"Helps in performance tuning in heavily concurrent environments.",
(gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency,
--- 1.198/sql/opt_range.cc 2006-01-30 17:54:12 +01:00
+++ 1.199/sql/opt_range.cc 2006-01-31 22:13:14 +01:00
@@ -753,7 +753,6 @@
table_map read_tables, COND *conds,
bool allow_null_cond,
int *error)
-
{
SQL_SELECT *select;
DBUG_ENTER("make_select");
@@ -7059,10 +7058,7 @@
if (!quick)
return 0; /* no ranges found */
if (quick->init())
- {
- delete quick;
goto err;
- }
quick->records= records;
if (cp_buffer_from_ref(thd,ref) && thd->is_fatal_error ||
@@ -8404,7 +8400,7 @@
ha_rows cur_records;
SEL_ARG *cur_index_tree= NULL;
ha_rows cur_quick_prefix_records= 0;
- uint cur_param_idx;
+ uint cur_param_idx=MAX_KEY;
key_map cur_used_key_parts;
uint pk= param->table->s->primary_key;
@@ -8620,6 +8616,7 @@
*/
if (cur_read_cost < best_read_cost - (DBL_EPSILON * cur_read_cost))
{
+ DBUG_ASSERT(tree != 0 || cur_param_idx == MAX_KEY);
index_info= cur_index_info;
index= cur_index;
best_read_cost= cur_read_cost;
--- 1.59/sql/opt_range.h 2006-01-04 09:11:19 +01:00
+++ 1.60/sql/opt_range.h 2006-01-31 22:13:14 +01:00
@@ -706,7 +706,7 @@
class FT_SELECT: public QUICK_RANGE_SELECT {
public:
FT_SELECT(THD *thd, TABLE *table, uint key) :
- QUICK_RANGE_SELECT (thd, table, key, 1) { init(); }
+ QUICK_RANGE_SELECT (thd, table, key, 1) { VOID(init()); }
~FT_SELECT() { file->ft_end(); }
int init() { return error=file->ft_init(); }
int reset() { return 0; }
--- 1.262/sql/slave.cc 2006-01-19 03:56:00 +01:00
+++ 1.263/sql/slave.cc 2006-01-31 22:13:14 +01:00
@@ -1742,7 +1742,8 @@
" to the relay log, "
"SHOW SLAVE STATUS may be inaccurate");
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
- flush_master_info(mi, 1);
+ if (flush_master_info(mi, 1))
+ sql_print_error("Failed to flush master info file");
delete ev;
}
else
@@ -2233,7 +2234,7 @@
pthread_mutex_unlock(&mi->rli.data_lock);
pthread_mutex_unlock(&mi->data_lock);
-
+
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(TRUE);
}
@@ -2241,8 +2242,13 @@
DBUG_RETURN(FALSE);
}
-
-bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
+/*
+ RETURN
+ 2 - flush relay log failed
+ 1 - flush master info failed
+ 0 - all ok
+*/
+int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
{
IO_CACHE* file = &mi->file;
char lbuf[22];
@@ -2261,8 +2267,9 @@
When we come to this place in code, relay log may or not be initialized;
the caller is responsible for setting 'flush_relay_log_cache' accordingly.
*/
- if (flush_relay_log_cache)
- flush_io_cache(mi->rli.relay_log.get_log_file());
+ if (flush_relay_log_cache &&
+ flush_io_cache(mi->rli.relay_log.get_log_file()))
+ DBUG_RETURN(2);
/*
We flushed the relay log BEFORE the master.info file, because if we crash
@@ -2274,13 +2281,13 @@
*/
/*
- In certain cases this code may create master.info files that seems
- corrupted, because of extra lines filled with garbage in the end
- file (this happens if new contents take less space than previous
- contents of file). But because of number of lines in the first line
+ In certain cases this code may create master.info files that seems
+ corrupted, because of extra lines filled with garbage in the end
+ file (this happens if new contents take less space than previous
+ contents of file). But because of number of lines in the first line
of file we don't care about this garbage.
*/
-
+
my_b_seek(file, 0L);
my_b_printf(file, "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n",
LINES_IN_MASTER_INFO_WITH_SSL,
@@ -2289,8 +2296,7 @@
mi->password, mi->port, mi->connect_retry,
(int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
mi->ssl_cipher, mi->ssl_key);
- flush_io_cache(file);
- DBUG_RETURN(0);
+ DBUG_RETURN(-flush_io_cache(file));
}
@@ -3355,7 +3361,11 @@
sql_print_error("Slave I/O thread could not queue event from master");
goto err;
}
- flush_master_info(mi, 1); /* sure that we can flush the relay log */
+ if (flush_master_info(mi, 1))
+ {
+ sql_print_error("Failed to flush master info file");
+ goto err;
+ }
/*
See if the relay logs take too much space.
We don't lock mi->rli.log_space_lock here; this dirty read saves time
--- 1.175/sql/sql_acl.cc 2006-01-13 17:04:32 +01:00
+++ 1.176/sql/sql_acl.cc 2006-01-31 22:13:14 +01:00
@@ -945,7 +945,7 @@
DBUG_PRINT("enter", ("Host: '%s', Ip: '%s', User: '%s', db: '%s'",
(host ? host : "(NULL)"), (ip ? ip : "(NULL)"),
- (user ? user : "(NULL)"), (db ? db : "(NULL)")));
+ user, (db ? db : "(NULL)")));
sctx->user= user;
sctx->host= host;
sctx->ip= ip;
@@ -974,7 +974,7 @@
for (i=0 ; i < acl_users.elements ; i++)
{
acl_user= dynamic_element(&acl_users,i,ACL_USER*);
- if ((!acl_user->user && (!user || !user[0])) ||
+ if ((!acl_user->user && !user[0]) ||
(acl_user->user && strcmp(user, acl_user->user) == 0))
{
if (compare_hostname(&acl_user->host, host, ip))
@@ -995,7 +995,7 @@
{
if (compare_hostname(&acl_db->host, host, ip))
{
- if (!acl_db->db || (db && !strcmp(acl_db->db, db)))
+ if (!acl_db->db || (db && !wild_compare(db, acl_db->db, 0)))
{
sctx->db_access= acl_db->access;
break;
@@ -4974,8 +4974,6 @@
}
if (! user)
user= "";
- if (! host)
- host= "";
#ifdef EXTRA_DEBUG
DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'",
struct_no, idx, user, host));
--- 1.125/sql/sql_db.cc 2006-01-19 03:56:00 +01:00
+++ 1.126/sql/sql_db.cc 2006-01-31 22:13:15 +01:00
@@ -287,7 +287,7 @@
}
-/*
+/*
Load database options file
load_db_opt()
@@ -313,68 +313,72 @@
bzero((char*) create,sizeof(*create));
create->default_table_charset= thd->variables.collation_server;
-
+
/* Check if options for this database are already in the hash */
if (!get_dbopt(path, create))
- DBUG_RETURN(0);
-
+ DBUG_RETURN(0);
+
/* Otherwise, load options from the .opt file */
- if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
- {
- IO_CACHE cache;
- init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0));
+ if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
+ goto err1;
+
+ IO_CACHE cache;
+ if (init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0)))
+ goto err2;
- while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
+ while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
+ {
+ char *pos= buf+nbytes-1;
+ /* Remove end space and control characters */
+ while (pos > buf && !my_isgraph(&my_charset_latin1, pos[-1]))
+ pos--;
+ *pos=0;
+ if ((pos= strchr(buf, '=')))
{
- char *pos= buf+nbytes-1;
- /* Remove end space and control characters */
- while (pos > buf && !my_isgraph(&my_charset_latin1, pos[-1]))
- pos--;
- *pos=0;
- if ((pos= strchr(buf, '=')))
+ if (!strncmp(buf,"default-character-set", (pos-buf)))
+ {
+ /*
+ Try character set name, and if it fails
+ try collation name, probably it's an old
+ 4.1.0 db.opt file, which didn't have
+ separate default-character-set and
+ default-collation commands.
+ */
+ if (!(create->default_table_charset=
+ get_charset_by_csname(pos+1, MY_CS_PRIMARY, MYF(0))) &&
+ !(create->default_table_charset=
+ get_charset_by_name(pos+1, MYF(0))))
+ {
+ sql_print_error("Error while loading database options: '%s':",path);
+ sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
+ create->default_table_charset= default_charset_info;
+ }
+ }
+ else if (!strncmp(buf,"default-collation", (pos-buf)))
{
- if (!strncmp(buf,"default-character-set", (pos-buf)))
- {
- /*
- Try character set name, and if it fails
- try collation name, probably it's an old
- 4.1.0 db.opt file, which didn't have
- separate default-character-set and
- default-collation commands.
- */
- if (!(create->default_table_charset=
- get_charset_by_csname(pos+1, MY_CS_PRIMARY, MYF(0))) &&
- !(create->default_table_charset=
- get_charset_by_name(pos+1, MYF(0))))
- {
- sql_print_error("Error while loading database options: '%s':",path);
- sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
- create->default_table_charset= default_charset_info;
- }
- }
- else if (!strncmp(buf,"default-collation", (pos-buf)))
- {
- if (!(create->default_table_charset= get_charset_by_name(pos+1,
- MYF(0))))
- {
- sql_print_error("Error while loading database options: '%s':",path);
- sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
- create->default_table_charset= default_charset_info;
- }
- }
+ if (!(create->default_table_charset= get_charset_by_name(pos+1,
+ MYF(0))))
+ {
+ sql_print_error("Error while loading database options: '%s':",path);
+ sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
+ create->default_table_charset= default_charset_info;
+ }
}
}
- end_io_cache(&cache);
- my_close(file,MYF(0));
- /*
- Put the loaded value into the hash.
- Note that another thread could've added the same
- entry to the hash after we called get_dbopt(),
- but it's not an error, as put_dbopt() takes this
- possibility into account.
- */
- error= put_dbopt(path, create);
}
+ /*
+ Put the loaded value into the hash.
+ Note that another thread could've added the same
+ entry to the hash after we called get_dbopt(),
+ but it's not an error, as put_dbopt() takes this
+ possibility into account.
+ */
+ error= put_dbopt(path, create);
+
+ end_io_cache(&cache);
+err2:
+ my_close(file,MYF(0));
+err1:
DBUG_RETURN(error);
}
--- 1.185/sql/sql_insert.cc 2006-01-11 09:16:19 +01:00
+++ 1.186/sql/sql_insert.cc 2006-01-31 22:50:13 +01:00
@@ -686,7 +686,7 @@
DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
- bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0);
+ VOID(bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0));
bitmap_clear_all(&used_fields);
view->contain_auto_increment= 0;
--- 1.515/sql/sql_parse.cc 2006-01-30 13:31:20 +01:00
+++ 1.516/sql/sql_parse.cc 2006-01-31 22:13:15 +01:00
@@ -1615,6 +1615,11 @@
statistic_increment(thd->status_var.com_other, &LOCK_status);
thd->enable_slow_log= opt_log_slow_admin_statements;
db= thd->alloc(db_len + tbl_len + 2);
+ if (!db)
+ {
+ my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+ break;
+ }
tbl_name= strmake(db, packet + 1, db_len)+1;
strmake(tbl_name, packet + db_len + 2, tbl_len);
mysql_table_dump(thd, db, tbl_name, -1);
@@ -1628,14 +1633,14 @@
statistic_increment(thd->status_var.com_other, &LOCK_status);
char *user= (char*) packet;
char *passwd= strend(user)+1;
- /*
+ /*
Old clients send null-terminated string ('\0' for empty string) for
password. New clients send the size (1 byte) + string (not null
terminated, so also '\0' for empty string).
*/
- char db_buff[NAME_LEN+1]; // buffer to store db in utf8
+ char db_buff[NAME_LEN+1]; // buffer to store db in utf8
char *db= passwd;
- uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
+ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
*passwd++ : strlen(passwd);
db+= passwd_len + 1;
#ifndef EMBEDDED_LIBRARY
@@ -6631,6 +6636,7 @@
#ifdef HAVE_REPLICATION
if (options & REFRESH_MASTER)
{
+ DBUG_ASSERT(thd);
tmp_write_to_binlog= 0;
if (reset_master(thd))
{
--- 1.295/sql/sql_show.cc 2006-01-31 18:46:37 +01:00
+++ 1.296/sql/sql_show.cc 2006-01-31 22:13:15 +01:00
@@ -783,7 +783,7 @@
it's a keyword
*/
- packet->reserve(length*2 + 2);
+ VOID(packet->reserve(length*2 + 2));
quote_char= (char) q;
packet->append("e_char, 1, system_charset_info);
@@ -1099,13 +1099,13 @@
if (key_part->field)
append_identifier(thd,packet,key_part->field->field_name,
strlen(key_part->field->field_name));
- if (!key_part->field ||
+ if (key_part->field &&
(key_part->length !=
table->field[key_part->fieldnr-1]->key_length() &&
!(key_info->flags & HA_FULLTEXT)))
{
buff[0] = '(';
- char* end=int10_to_str((long) key_part->length /
+ char* end=int10_to_str((long) key_part->length /
key_part->field->charset()->mbmaxlen,
buff + 1,10);
*end++ = ')';
@@ -1856,7 +1856,8 @@
{
MEM_ROOT *mem= thd->mem_root;
if (allocate_lex_string)
- lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING));
+ if (!(lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING))))
+ return 0;
lex_str->str= strmake_root(mem, str, length);
lex_str->length= length;
return lex_str;
@@ -3115,7 +3116,7 @@
/*
I.e. we are in SELECT FROM INFORMATION_SCHEMA.STATISTICS
rather than in SHOW KEYS
- */
+ */
if (!tables->view)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
thd->net.last_errno, thd->net.last_error);
@@ -3128,7 +3129,7 @@
{
TABLE *show_table= tables->table;
KEY *key_info=show_table->key_info;
- show_table->file->info(HA_STATUS_VARIABLE |
+ show_table->file->info(HA_STATUS_VARIABLE |
HA_STATUS_NO_LOCK |
HA_STATUS_TIME);
for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
@@ -3140,7 +3141,7 @@
restore_record(table, s->default_values);
table->field[1]->store(base_name, strlen(base_name), cs);
table->field[2]->store(file_name, strlen(file_name), cs);
- table->field[3]->store((longlong) ((key_info->flags &
+ table->field[3]->store((longlong) ((key_info->flags &
HA_NOSAME) ? 0 : 1), TRUE);
table->field[4]->store(base_name, strlen(base_name), cs);
table->field[5]->store(key_info->name, strlen(key_info->name), cs);
@@ -3163,12 +3164,12 @@
table->field[9]->store((longlong) records, TRUE);
table->field[9]->set_notnull();
}
- if (!(key_info->flags & HA_FULLTEXT) &&
- (!key_part->field ||
- key_part->length !=
+ if (!(key_info->flags & HA_FULLTEXT) &&
+ (key_part->field &&
+ key_part->length !=
show_table->field[key_part->fieldnr-1]->key_length()))
{
- table->field[10]->store((longlong) key_part->length /
+ table->field[10]->store((longlong) key_part->length /
key_part->field->charset()->mbmaxlen);
table->field[10]->set_notnull();
}
--- 1.44/sql/sql_test.cc 2005-11-23 21:44:57 +01:00
+++ 1.45/sql/sql_test.cc 2006-01-31 22:13:15 +01:00
@@ -450,7 +450,7 @@
calc_sum_of_all_status(&tmp);
printf("\nStatus information:\n\n");
- my_getwd(current_dir, sizeof(current_dir),MYF(0));
+ VOID(my_getwd(current_dir, sizeof(current_dir),MYF(0)));
printf("Current dir: %s\n", current_dir);
printf("Running threads: %d Stack size: %ld\n", thread_count,
(long) thread_stack);
--- 1.447/sql/sql_yacc.yy 2006-01-30 13:31:21 +01:00
+++ 1.448/sql/sql_yacc.yy 2006-01-31 22:50:13 +01:00
@@ -2288,7 +2288,10 @@
;
sp_proc_stmt_if:
- IF sp_if END IF {}
+ IF
+ { Lex->sphead->new_cont_backpatch(NULL); }
+ sp_if END IF
+ { Lex->sphead->do_cont_backpatch(); }
;
sp_proc_stmt_statement:
@@ -2366,13 +2369,17 @@
CASE_SYM WHEN_SYM
{
Lex->sphead->m_flags&= ~sp_head::IN_SIMPLE_CASE;
+ Lex->sphead->new_cont_backpatch(NULL);
}
- sp_case END CASE_SYM {}
+ sp_case END CASE_SYM { Lex->sphead->do_cont_backpatch(); }
;
sp_proc_stmt_case:
CASE_SYM
- { Lex->sphead->reset_lex(YYTHD); }
+ {
+ Lex->sphead->reset_lex(YYTHD);
+ Lex->sphead->new_cont_backpatch(NULL);
+ }
expr WHEN_SYM
{
LEX *lex= Lex;
@@ -2396,6 +2403,7 @@
sp_case END CASE_SYM
{
Lex->spcont->pop_case_expr_id();
+ Lex->sphead->do_cont_backpatch();
}
;
@@ -2686,6 +2694,7 @@
$2, lex);
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
+ sp->add_cont_backpatch(i);
sp->add_instr(i);
sp->restore_lex(YYTHD);
}
@@ -2744,6 +2753,7 @@
i= new sp_instr_jump_if_not(ip, ctx, expr, lex);
}
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
+ sp->add_cont_backpatch(i);
sp->add_instr(i);
sp->restore_lex(YYTHD);
}
@@ -2873,6 +2883,7 @@
/* Jumping forward */
sp->push_backpatch(i, lex->spcont->last_label());
+ sp->new_cont_backpatch(i);
sp->add_instr(i);
sp->restore_lex(YYTHD);
}
@@ -2884,6 +2895,7 @@
sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
lex->sphead->add_instr(i);
+ lex->sphead->do_cont_backpatch();
}
| REPEAT_SYM sp_proc_stmts1 UNTIL_SYM
{ Lex->sphead->reset_lex(YYTHD); }
@@ -2897,6 +2909,8 @@
lex);
lex->sphead->add_instr(i);
lex->sphead->restore_lex(YYTHD);
+ /* We can shortcut the cont_backpatch here */
+ i->m_cont_dest= ip+1;
}
;
--- 1.204/sql/table.cc 2006-01-24 17:46:07 +01:00
+++ 1.205/sql/table.cc 2006-01-31 22:13:16 +01:00
@@ -1640,7 +1640,10 @@
ret_value=uint4korr(pos);
}
if (! save_names)
- my_free((gptr) buf,MYF(0));
+ {
+ if (names)
+ my_free((gptr) buf,MYF(0));
+ }
else if (!names)
bzero((char*) save_names,sizeof(save_names));
else
--- 1.77/sql/share/errmsg.txt 2006-01-27 01:07:29 +01:00
+++ 1.78/sql/share/errmsg.txt 2006-01-31 22:13:16 +01:00
@@ -5172,8 +5172,8 @@
eng "Incorrect number of FETCH variables"
ger "Falsche Anzahl von FETCH-Variablen"
ER_SP_FETCH_NO_DATA 02000
- eng "No data to FETCH"
- ger "Keine Daten mit FETCH abzuholen"
+ eng "No data - zero rows fetched, selected, or processed"
ER_SP_DUP_PARAM 42000
eng "Duplicate parameter: %s"
ger "Doppelter Parameter: %s"
--- 1.82/sql-common/client.c 2006-01-03 17:54:34 +01:00
+++ 1.83/sql-common/client.c 2006-01-31 22:13:16 +01:00
@@ -1456,6 +1456,24 @@
mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
mysql->options.report_data_truncation= TRUE; /* default */
+
+ /*
+ By default we don't reconnect because it could silently corrupt data (after
+ reconnection you potentially lose table locks, user variables, session
+ variables (transactions but they are specifically dealt with in
+ mysql_reconnect()).
+ This is a change: < 5.0.3 mysql->reconnect was set to 1 by default.
+ How this change impacts existing apps:
+ - existing apps which relyed on the default will see a behaviour change;
+ they will have to set reconnect=1 after mysql_real_connect().
+ - existing apps which explicitely asked for reconnection (the only way they
+ could do it was by setting mysql.reconnect to 1 after mysql_real_connect())
+ will not see a behaviour change.
+ - existing apps which explicitely asked for no reconnection
+ (mysql.reconnect=0) will not see a behaviour change.
+ */
+ mysql->reconnect= 0;
+
return mysql;
}
@@ -1545,7 +1563,8 @@
NULL,
cli_read_statistics,
cli_read_query_result,
- cli_read_change_user_result
+ cli_read_change_user_result,
+ cli_read_binary_rows
#endif
};
@@ -1624,23 +1643,6 @@
port=mysql->options.port;
if (!unix_socket)
unix_socket=mysql->options.unix_socket;
-
- /*
- By default we don't reconnect because it could silently corrupt data (after
- reconnection you potentially lose table locks, user variables, session
- variables (transactions but they are specifically dealt with in
- mysql_reconnect()).
- This is a change: < 5.0.3 mysql->reconnect was set to 1 by default.
- How this change impacts existing apps:
- - existing apps which relyed on the default will see a behaviour change;
- they will have to set reconnect=1 after mysql_real_connect().
- - existing apps which explicitely asked for reconnection (the only way they
- could do it was by setting mysql.reconnect to 1 after mysql_real_connect())
- will not see a behaviour change.
- - existing apps which explicitely asked for no reconnection
- (mysql.reconnect=0) will not see a behaviour change.
- */
- mysql->reconnect= 0;
mysql->server_status=SERVER_STATUS_AUTOCOMMIT;
@@ -2339,8 +2341,9 @@
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR));
/* Clear pointers for better safety */
- mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
+ mysql->info_buffer=mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
}
@@ -2476,8 +2479,7 @@
if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
mysql->server_status|= SERVER_STATUS_IN_TRANS;
- if (!(fields=(*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,
- protocol_41(mysql) ? 7 : 5)))
+ if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5)))
DBUG_RETURN(1);
if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
(uint) field_count,0,
--- 1.36/mysys/my_bitmap.c 2005-07-20 00:40:08 +02:00
+++ 1.37/mysys/my_bitmap.c 2006-01-31 22:50:13 +01:00
@@ -114,7 +114,7 @@
#endif
;
if (!(buf= (uint32*) my_malloc(size_in_bytes, MYF(MY_WME))))
- return 1;
+ DBUG_RETURN(1);
}
#ifdef THREAD
else
--- 1.10/mysql-test/r/view_grant.result 2006-01-19 10:25:04 +01:00
+++ 1.11/mysql-test/r/view_grant.result 2006-01-31 22:13:12 +01:00
@@ -350,12 +350,12 @@
f2()
NULL
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
select * from v2;
f2()
NULL
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
select * from v3;
ERROR HY000: View 'mysqltest.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from v4;
@@ -396,12 +396,12 @@
f2()
NULL
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
select * from v4;
f2()
NULL
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1, v2, v3, v4, v5;
--- 1.28/mysql-test/r/mysqltest.result 2006-01-31 13:07:42 +01:00
+++ 1.29/mysql-test/r/mysqltest.result 2006-01-31 22:13:12 +01:00
@@ -361,6 +361,7 @@
mysqltest: In included file "./var/tmp/con.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c
mysqltest: In included file "./var/tmp/con.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "./var/tmp/con.sql": At line 2: Connection test_con1 already exists
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
Output from mysqltest-x.inc
Output from mysqltest-x.inc
Output from mysqltest-x.inc
--- 1.32/mysql-test/t/mysqltest.test 2006-01-31 04:58:13 +01:00
+++ 1.33/mysql-test/t/mysqltest.test 2006-01-31 22:13:12 +01:00
@@ -909,7 +909,13 @@
--error 1
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
-
+# connect when "disable_abort_on_error" caused "connection not found"
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--disable_abort_on_error
+connect (con1,localhost,root,,);
+connection default;
+connection con1;
+--enable_abort_on_error
# ----------------------------------------------------------------------------
# Test mysqltest arguments
--- 1.34.7.2/innobase/include/os0file.h 2006-01-16 12:03:55 +01:00
+++ 1.44/storage/innobase/include/os0file.h 2006-01-31 22:13:16 +01:00
@@ -188,7 +188,7 @@
FILE*
os_file_create_tmpfile(void);
/*========================*/
- /* out: temporary file handle, or NULL on error */
+ /* out: temporary file handle (never NULL) */
/***************************************************************************
The os_file_opendir() function opens a directory stream corresponding to the
directory named by the dirname argument. The directory stream is positioned
--- 1.39.5.1/innobase/include/row0mysql.h 2006-01-16 12:03:55 +01:00
+++ 1.46/storage/innobase/include/row0mysql.h 2006-01-31 22:13:16 +01:00
@@ -613,6 +613,31 @@
that was decided in ha_innodb.cc,
::store_lock(), ::external_lock(),
etc. */
+ ulint row_read_type; /* ROW_READ_WITH_LOCKS if row locks
+ should be the obtained for records
+ under an UPDATE or DELETE cursor.
+ If innodb_locks_unsafe_for_binlog
+ is TRUE, this can be set to
+ ROW_READ_TRY_SEMI_CONSISTENT, so that
+ if the row under an UPDATE or DELETE
+ cursor was locked by another
+ transaction, InnoDB will resort
+ to reading the last committed value
+ ('semi-consistent read'). Then,
+ this field will be set to
+ ROW_READ_DID_SEMI_CONSISTENT to
+ indicate that. If the row does not
+ match the WHERE condition, MySQL will
+ invoke handler::unlock_row() to
+ clear the flag back to
+ ROW_READ_TRY_SEMI_CONSISTENT and
+ to simply skip the row. If
+ the row matches, the next call to
+ row_search_for_mysql() will lock
+ the row.
+ This eliminates lock waits in some
+ cases; note that this breaks
+ serializability. */
ulint mysql_prefix_len;/* byte offset of the end of
the last requested column */
ulint mysql_row_len; /* length in bytes of a row in the
@@ -657,6 +682,11 @@
/* Values for hint_need_to_fetch_extra_cols */
#define ROW_RETRIEVE_PRIMARY_KEY 1
#define ROW_RETRIEVE_ALL_COLS 2
+
+/* Values for row_read_type */
+#define ROW_READ_WITH_LOCKS 0
+#define ROW_READ_TRY_SEMI_CONSISTENT 1
+#define ROW_READ_DID_SEMI_CONSISTENT 2
#ifndef UNIV_NONINL
--- 1.51.7.2/innobase/include/srv0srv.h 2006-01-18 13:20:46 +01:00
+++ 1.59/storage/innobase/include/srv0srv.h 2006-01-31 22:13:16 +01:00
@@ -34,18 +34,6 @@
extern mutex_t srv_monitor_file_mutex;
/* Temporary file for innodb monitor output */
extern FILE* srv_monitor_file;
-/* Mutex for locking srv_dict_tmpfile.
-This mutex has a very high rank; threads reserving it should not
-be holding any InnoDB latches. */
-extern mutex_t srv_dict_tmpfile_mutex;
-/* Temporary file for output from the data dictionary */
-extern FILE* srv_dict_tmpfile;
-/* Mutex for locking srv_misc_tmpfile.
-This mutex has a very low rank; threads reserving it should not
-acquire any further latches or sleep before releasing this one. */
-extern mutex_t srv_misc_tmpfile_mutex;
-/* Temporary file for miscellanous diagnostic output */
-extern FILE* srv_misc_tmpfile;
/* Server parameters which are read from the initfile */
--- 1.55.7.1/innobase/lock/lock0lock.c 2006-01-16 12:03:55 +01:00
+++ 1.65/storage/innobase/lock/lock0lock.c 2006-01-31 22:50:13 +01:00
@@ -1705,7 +1705,7 @@
lock_t*
lock_rec_create(
/*============*/
- /* out: created lock, NULL if out of memory */
+ /* out: created lock */
ulint type_mode,/* in: lock mode and wait flag, type is
ignored and replaced by LOCK_REC */
rec_t* rec, /* in: record on page */
@@ -1746,11 +1746,6 @@
n_bytes = 1 + n_bits / 8;
lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t) + n_bytes);
-
- if (UNIV_UNLIKELY(lock == NULL)) {
-
- return(NULL);
- }
UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock);
@@ -1886,8 +1881,7 @@
lock_t*
lock_rec_add_to_queue(
/*==================*/
- /* out: lock where the bit was set, NULL if out
- of memory */
+ /* out: lock where the bit was set */
ulint type_mode,/* in: lock mode, wait, gap etc. flags;
type is ignored and replaced by LOCK_REC */
rec_t* rec, /* in: record on page */
@@ -3405,8 +3399,7 @@
lock_t*
lock_table_create(
/*==============*/
- /* out, own: new lock object, or NULL if
- out of memory */
+ /* out, own: new lock object */
dict_table_t* table, /* in: database table in dictionary cache */
ulint type_mode,/* in: lock mode possibly ORed with
LOCK_WAIT */
@@ -3432,11 +3425,6 @@
lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t));
}
- if (lock == NULL) {
-
- return(NULL);
- }
-
UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock);
lock->type_mode = type_mode | LOCK_TABLE;
@@ -3773,6 +3761,32 @@
rec_t* rec, /* in: record */
ulint lock_mode) /* in: LOCK_S or LOCK_X */
{
+ lock_t* lock;
+ ulint heap_no;
+
+ ut_ad(trx && rec);
+
+ mutex_enter(&kernel_mutex);
+
+ heap_no = rec_get_heap_no(rec, page_rec_is_comp(rec));
+
+ lock = lock_rec_get_first(rec);
+
+ /* Remove the record lock */
+
+ while (lock != NULL) {
+ if (lock->trx == trx && lock_get_mode(lock) == lock_mode) {
+ ut_a(!lock_get_wait(lock));
+
+ lock_rec_reset_nth_bit(lock, heap_no);
+
+ break;
+ }
+
+ lock = lock_rec_get_next(rec, lock);
+ }
+
+ if (UNIV_UNLIKELY(lock == NULL)) {
lock_t* lock;
lock_t* release_lock = NULL;
ulint heap_no;
--- 1.65.10.1/innobase/row/row0ins.c 2006-01-16 12:03:55 +01:00
+++ 1.75/storage/innobase/row/row0ins.c 2006-01-31 22:13:17 +01:00
@@ -597,21 +597,20 @@
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign) /* in: foreign key constraint */
{
- mutex_enter(&srv_misc_tmpfile_mutex);
- rewind(srv_misc_tmpfile);
+
+ FILE* tf = os_file_create_tmpfile();
- if (os_file_set_eof(srv_misc_tmpfile)) {
- ut_print_name(srv_misc_tmpfile, trx,
- foreign->foreign_table_name);
- dict_print_info_on_foreign_key_in_create_format(
- srv_misc_tmpfile,
- trx, foreign, FALSE);
- trx_set_detailed_error_from_file(trx, srv_misc_tmpfile);
+ if (tf) {
+ ut_print_name(tf, trx, foreign->foreign_table_name);
+ dict_print_info_on_foreign_key_in_create_format(tf, trx,
+ foreign, FALSE);
+
+ trx_set_detailed_error_from_file(trx, tf);
+
+ fclose(tf);
} else {
- trx_set_detailed_error(trx, "temp file operation failed");
+ trx_set_detailed_error(trx, "temp file creation failed");
}
-
- mutex_exit(&srv_misc_tmpfile_mutex);
}
/*************************************************************************
@@ -719,7 +718,7 @@
}
if (rec) {
- rec_print(ef, rec, foreign->referenced_index);
+ rec_print(ef, rec, foreign->foreign_index);
}
putc('\n', ef);
--- 1.103.12.1/innobase/row/row0mysql.c 2006-01-16 12:03:55 +01:00
+++ 1.120/storage/innobase/row/row0mysql.c 2006-01-31 22:13:17 +01:00
@@ -626,6 +626,8 @@
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = 99999999;
+ prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
+
prebuilt->sel_graph = NULL;
prebuilt->search_tuple = dtuple_create(heap,
@@ -2132,7 +2134,7 @@
if (err == DB_SUCCESS) {
/* Check that also referencing constraints are ok */
- err = dict_load_foreigns(name, TRUE);
+ err = dict_load_foreigns(name, trx->check_foreigns);
}
if (err != DB_SUCCESS) {
@@ -3490,7 +3492,8 @@
const char* name) /* in: table name in the form
'database/tablename' */
{
- return(strstr(name, "/#sql") != NULL);
+ /* return(strstr(name, "/#sql") != NULL); */
+ return(strstr(name, "/@0023sql") != NULL);
}
/*************************************************************************
@@ -3590,8 +3593,7 @@
mem_heap_t* heap = NULL;
const char** constraints_to_drop = NULL;
ulint n_constraints_to_drop = 0;
- ibool recovering_temp_table = FALSE;
- ibool old_is_tmp, new_is_tmp;
+ ibool recovering_temp_table = FALSE;
ulint len;
ulint i;
ibool success;
@@ -3631,9 +3633,6 @@
trx->op_info = "renaming table";
trx_start_if_not_started(trx);
- old_is_tmp = row_is_mysql_tmp_table_name(old_name);
- new_is_tmp = row_is_mysql_tmp_table_name(new_name);
-
if (row_mysql_is_recovered_tmp_table(new_name)) {
recovering_temp_table = TRUE;
@@ -3680,7 +3679,7 @@
len = (sizeof str1) + (sizeof str2) + (sizeof str3) + (sizeof str5) - 4
+ ut_strlenq(new_name, '\'') + ut_strlenq(old_name, '\'');
- if (new_is_tmp) {
+ if (row_is_mysql_tmp_table_name(new_name)) {
db_name_len = dict_get_db_name_len(old_name) + 1;
/* MySQL is doing an ALTER TABLE command and it renames the
@@ -3833,7 +3832,7 @@
the table is stored in a single-table tablespace */
success = dict_table_rename_in_cache(table, new_name,
- !new_is_tmp);
+ !row_is_mysql_tmp_table_name(new_name));
if (!success) {
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, FALSE, NULL);
@@ -3850,16 +3849,19 @@
goto funct_exit;
}
- /* We only want to switch off some of the type checking in
- an ALTER, not in a RENAME. */
-
- err = dict_load_foreigns(new_name,
- old_is_tmp ? trx->check_foreigns : TRUE);
+ err = dict_load_foreigns(new_name, trx->check_foreigns);
- if (err != DB_SUCCESS) {
- ut_print_timestamp(stderr);
+ if (row_is_mysql_tmp_table_name(old_name)) {
- if (old_is_tmp) {
+ /* MySQL is doing an ALTER TABLE command and it
+ renames the created temporary table to the name
+ of the original table. In the ALTER TABLE we maybe
+ created some FOREIGN KEY constraints for the temporary
+ table. But we want to load also the foreign key
+ constraint definitions for the original table name. */
+
+ if (err != DB_SUCCESS) {
+ ut_print_timestamp(stderr);
fputs(" InnoDB: Error: in ALTER TABLE ",
stderr);
ut_print_name(stderr, trx, new_name);
@@ -3867,23 +3869,36 @@
"InnoDB: has or is referenced in foreign key constraints\n"
"InnoDB: which are not compatible with the new table definition.\n",
stderr);
- } else {
+
+ ut_a(dict_table_rename_in_cache(table,
+ old_name, FALSE));
+ trx->error_state = DB_SUCCESS;
+ trx_general_rollback_for_mysql(trx, FALSE,
+ NULL);
+ trx->error_state = DB_SUCCESS;
+ }
+ } else {
+ if (err != DB_SUCCESS) {
+
+ ut_print_timestamp(stderr);
+
fputs(
" InnoDB: Error: in RENAME TABLE table ",
stderr);
ut_print_name(stderr, trx, new_name);
fputs("\n"
- "InnoDB: is referenced in foreign key constraints\n"
- "InnoDB: which are not compatible with the new table definition.\n",
+ "InnoDB: is referenced in foreign key constraints\n"
+ "InnoDB: which are not compatible with the new table definition.\n",
stderr);
- }
-
- ut_a(dict_table_rename_in_cache(table,
+
+ ut_a(dict_table_rename_in_cache(table,
old_name, FALSE));
- trx->error_state = DB_SUCCESS;
- trx_general_rollback_for_mysql(trx, FALSE,
- NULL);
- trx->error_state = DB_SUCCESS;
+
+ trx->error_state = DB_SUCCESS;
+ trx_general_rollback_for_mysql(trx, FALSE,
+ NULL);
+ trx->error_state = DB_SUCCESS;
+ }
}
}
funct_exit:
--- 1.92.5.1/innobase/row/row0sel.c 2006-01-16 12:03:55 +01:00
+++ 1.100/storage/innobase/row/row0sel.c 2006-01-31 22:13:17 +01:00
@@ -536,6 +536,41 @@
}
/*************************************************************************
+Builds the last committed version of a clustered index record for a
+semi-consistent read. */
+static
+ulint
+row_sel_build_committed_vers_for_mysql(
+/*===================================*/
+ /* out: DB_SUCCESS or error code */
+ dict_index_t* clust_index, /* in: clustered index */
+ row_prebuilt_t* prebuilt, /* in: prebuilt struct */
+ rec_t* rec, /* in: record in a clustered index */
+ ulint** offsets, /* in/out: offsets returned by
+ rec_get_offsets(rec, clust_index) */
+ mem_heap_t** offset_heap, /* in/out: memory heap from which
+ the offsets are allocated */
+ rec_t** old_vers, /* out: old version, or NULL if the
+ record does not exist in the view:
+ i.e., it was freshly inserted
+ afterwards */
+ mtr_t* mtr) /* in: mtr */
+{
+ ulint err;
+
+ if (prebuilt->old_vers_heap) {
+ mem_heap_empty(prebuilt->old_vers_heap);
+ } else {
+ prebuilt->old_vers_heap = mem_heap_create(200);
+ }
+
+ err = row_vers_build_for_semi_consistent_read(rec, mtr, clust_index,
+ offsets, offset_heap,
+ prebuilt->old_vers_heap, old_vers);
+ return(err);
+}
+
+/*************************************************************************
Tests the conditions which determine when the index segment we are searching
through has been exhausted. */
UNIV_INLINE
@@ -3066,7 +3101,6 @@
rec_t* rec;
rec_t* result_rec;
rec_t* clust_rec;
- rec_t* old_vers;
ulint err = DB_SUCCESS;
ibool unique_search = FALSE;
ibool unique_search_from_clust_index = FALSE;
@@ -3077,6 +3111,11 @@
locking SELECT, and the isolation
level is <= TRX_ISO_READ_COMMITTED,
then this is set to FALSE */
+ ibool did_semi_consistent_read = FALSE;
+ /* if the returned record was locked
+ and we did a semi-consistent read
+ (fetch the newest committed version),
+ then this is set to TRUE */
#ifdef UNIV_SEARCH_DEBUG
ulint cnt = 0;
#endif /* UNIV_SEARCH_DEBUG */
@@ -3163,7 +3202,7 @@
trx->search_latch_timeout = BTR_SEA_TIMEOUT;
}
- /* Reset the new record lock info if we srv_locks_unsafe_for_binlog
+ /* Reset the new record lock info if srv_locks_unsafe_for_binlog
is set. Then we are able to remove the record locks set here on an
individual row. */
@@ -3431,9 +3470,28 @@
clust_index = dict_table_get_first_index(index->table);
if (UNIV_LIKELY(direction != 0)) {
- if (!sel_restore_position_for_mysql(&same_user_rec,
- BTR_SEARCH_LEAF,
- pcur, moves_up, &mtr)) {
+ ibool need_to_process = sel_restore_position_for_mysql(
+ &same_user_rec, BTR_SEARCH_LEAF,
+ pcur, moves_up, &mtr);
+
+ if (UNIV_UNLIKELY(need_to_process)) {
+ if (UNIV_UNLIKELY(prebuilt->row_read_type
+ == ROW_READ_DID_SEMI_CONSISTENT)) {
+ /* We did a semi-consistent read,
+ but the record was removed in
+ the meantime. */
+ prebuilt->row_read_type
+ = ROW_READ_TRY_SEMI_CONSISTENT;
+ }
+ } else if (UNIV_LIKELY(prebuilt->row_read_type
+ != ROW_READ_DID_SEMI_CONSISTENT)) {
+
+ /* The cursor was positioned on the record
+ that we returned previously. If we need
+ to repeat a semi-consistent read as a
+ pessimistic locking read, the record
+ cannot be skipped. */
+
goto next_rec;
}
@@ -3751,7 +3809,64 @@
prebuilt->select_lock_type,
lock_type, thr);
- if (err != DB_SUCCESS) {
+ switch (err) {
+ rec_t* old_vers;
+ case DB_SUCCESS:
+ break;
+ case DB_LOCK_WAIT:
+ if (UNIV_LIKELY(prebuilt->row_read_type
+ != ROW_READ_TRY_SEMI_CONSISTENT)
+ || index != clust_index) {
+
+ goto lock_wait_or_error;
+ }
+
+ /* The following call returns 'offsets'
+ associated with 'old_vers' */
+ err = row_sel_build_committed_vers_for_mysql(
+ clust_index, prebuilt, rec,
+ &offsets, &heap,
+ &old_vers, &mtr);
+
+ if (err != DB_SUCCESS) {
+
+ goto lock_wait_or_error;
+ }
+
+ mutex_enter(&kernel_mutex);
+ if (trx->was_chosen_as_deadlock_victim) {
+ mutex_exit(&kernel_mutex);
+
+ goto lock_wait_or_error;
+ }
+ if (UNIV_LIKELY(trx->wait_lock != NULL)) {
+ lock_cancel_waiting_and_release(
+ trx->wait_lock);
+ trx_reset_new_rec_lock_info(trx);
+ } else {
+ mutex_exit(&kernel_mutex);
+
+ /* The lock was granted while we were
+ searching for the last committed version.
+ Do a normal locking read. */
+
+ offsets = rec_get_offsets(rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
+ err = DB_SUCCESS;
+ break;
+ }
+ mutex_exit(&kernel_mutex);
+
+ if (old_vers == NULL) {
+ /* The row was not yet committed */
+
+ goto next_rec;
+ }
+
+ did_semi_consistent_read = TRUE;
+ rec = old_vers;
+ break;
+ default:
goto lock_wait_or_error;
}
@@ -3775,6 +3890,7 @@
&& !lock_clust_rec_cons_read_sees(rec, index,
offsets, trx->read_view)) {
+ rec_t* old_vers;
/* The following call returns 'offsets'
associated with 'old_vers' */
err = row_sel_build_prev_vers_for_mysql(
@@ -3821,14 +3937,13 @@
/* The record is delete-marked: we can skip it */
if (srv_locks_unsafe_for_binlog
- && prebuilt->select_lock_type != LOCK_NONE) {
+ && prebuilt->select_lock_type != LOCK_NONE
+ && !did_semi_consistent_read) {
/* No need to keep a lock on a delete-marked record
if we do not want to use next-key locking. */
row_unlock_for_mysql(prebuilt, TRUE);
-
- trx_reset_new_rec_lock_info(trx);
}
goto next_rec;
@@ -3882,8 +3997,6 @@
locking. */
row_unlock_for_mysql(prebuilt, TRUE);
-
- trx_reset_new_rec_lock_info(trx);
}
goto next_rec;
@@ -3990,6 +4103,19 @@
goto normal_return;
next_rec:
+ /* Reset the old and new "did semi-consistent read" flags. */
+ if (UNIV_UNLIKELY(prebuilt->row_read_type
+ == ROW_READ_DID_SEMI_CONSISTENT)) {
+ prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
+ }
+ did_semi_consistent_read = FALSE;
+
+ if (UNIV_UNLIKELY(srv_locks_unsafe_for_binlog)
+ && prebuilt->select_lock_type != LOCK_NONE) {
+
+ trx_reset_new_rec_lock_info(trx);
+ }
+
/*-------------------------------------------------------------*/
/* PHASE 5: Move the cursor to the next index record */
@@ -4042,8 +4168,14 @@
goto rec_loop;
lock_wait_or_error:
- /*-------------------------------------------------------------*/
+ /* Reset the old and new "did semi-consistent read" flags. */
+ if (UNIV_UNLIKELY(prebuilt->row_read_type
+ == ROW_READ_DID_SEMI_CONSISTENT)) {
+ prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
+ }
+ did_semi_consistent_read = FALSE;
+ /*-------------------------------------------------------------*/
btr_pcur_store_position(pcur, &mtr);
mtr_commit(&mtr);
@@ -4125,6 +4257,20 @@
trx->op_info = "";
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
+ }
+
+ /* Set or reset the "did semi-consistent read" flag on return.
+ The flag did_semi_consistent_read is set if and only if
+ the record being returned was fetched with a semi-consistent read. */
+ ut_ad(prebuilt->row_read_type != ROW_READ_WITH_LOCKS
+ || !did_semi_consistent_read);
+
+ if (UNIV_UNLIKELY(prebuilt->row_read_type != ROW_READ_WITH_LOCKS)) {
+ if (UNIV_UNLIKELY(did_semi_consistent_read)) {
+ prebuilt->row_read_type = ROW_READ_DID_SEMI_CONSISTENT;
+ } else {
+ prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
+ }
}
return(err);
}
--- 1.87.9.2/innobase/srv/srv0srv.c 2006-01-18 13:20:46 +01:00
+++ 1.96/storage/innobase/srv/srv0srv.c 2006-01-31 22:13:17 +01:00
@@ -398,18 +398,6 @@
mutex_t srv_monitor_file_mutex;
/* Temporary file for innodb monitor output */
FILE* srv_monitor_file;
-/* Mutex for locking srv_dict_tmpfile.
-This mutex has a very high rank; threads reserving it should not
-be holding any InnoDB latches. */
-mutex_t srv_dict_tmpfile_mutex;
-/* Temporary file for output from the data dictionary */
-FILE* srv_dict_tmpfile;
-/* Mutex for locking srv_misc_tmpfile.
-This mutex has a very low rank; threads reserving it should not
-acquire any further latches or sleep before releasing this one. */
-mutex_t srv_misc_tmpfile_mutex;
-/* Temporary file for miscellanous diagnostic output */
-FILE* srv_misc_tmpfile;
ulint srv_main_thread_process_no = 0;
ulint srv_main_thread_id = 0;
--- 1.58/mysql-test/r/alter_table.result 2005-12-31 05:51:12 +01:00
+++ 1.59/mysql-test/r/alter_table.result 2006-01-31 22:50:13 +01:00
@@ -616,4 +616,7 @@
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
i v
4 3r4f
+create table t1 (t varchar(255) default null, key t (t(80)))
+engine=myisam default charset=latin1;
+alter table t1 change t t text;
drop table t1;
--- 1.155/mysql-test/r/innodb.result 2006-01-30 15:02:50 +01:00
+++ 1.156/mysql-test/r/innodb.result 2006-01-31 22:13:12 +01:00
@@ -1783,15 +1783,15 @@
innodb_sync_spin_loops 20
show variables like "innodb_thread_concurrency";
Variable_name Value
-innodb_thread_concurrency 20
-set global innodb_thread_concurrency=1000;
+innodb_thread_concurrency 0
+set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 1000
set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
Variable_name Value
-innodb_thread_concurrency 1
+innodb_thread_concurrency 0
set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
Variable_name Value
@@ -2661,6 +2661,32 @@
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05630563 05630563 email
+4 0563 0563 email
+4 05612020 05612020 email
+4 01FC 01FC email
+4 0120 0120 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0000E400 0000E400 email
+4 0000563001FC0563 0000563001FC0563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
drop table t1;
drop table t2;
create table t1 (
@@ -2689,6 +2715,32 @@
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05630563 05630563 email
+4 0563 0563 email
+4 05612020 05612020 email
+4 01FC 01FC email
+4 0120 0120 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0000E400 0000E400 email
+4 0000563001FC0563 0000563001FC0563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
drop table t1;
drop table t2;
create table t1 (
@@ -2717,6 +2769,32 @@
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0120 0120 email
+4 01FC 01FC email
+4 0563 0563 email
+4 0000563001FC0563 0000563001FC0563 email
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 05612020 05612020 email
+4 05630563 05630563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
drop table t1;
drop table t2;
create table t1 (
@@ -2741,6 +2819,28 @@
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0120 0120 email
+4 01FC 01FC email
+4 05612020 05612020 email
+4 0563 0563 email
+1 61626364656667 61626364656667 one
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
drop table t1;
drop table t2;
commit;
@@ -2757,4 +2857,208 @@
e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=innodb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes
-End of 5.0 tests
+create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
+create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
+create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
+create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
+insert into t1 values (0x41),(0x4120),(0x4100);
+insert into t2 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A' for key 1
+insert into t2 values (0x41),(0x4120);
+insert into t3 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A ' for key 1
+insert into t3 values (0x41),(0x4100);
+insert into t4 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A' for key 1
+insert into t4 values (0x41),(0x4100);
+select hex(s1) from t1;
+hex(s1)
+41
+4100
+4120
+select hex(s1) from t2;
+hex(s1)
+4100
+4120
+select hex(s1) from t3;
+hex(s1)
+4100
+41
+select hex(s1) from t4;
+hex(s1)
+4100
+41
+drop table t1,t2,t3,t4;
+create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
+create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
+insert into t2 values(0x42);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+insert into t2 values(0x41);
+select hex(s1) from t2;
+hex(s1)
+4100
+update t1 set s1=0x123456 where a=2;
+select hex(s1) from t2;
+hex(s1)
+4100
+update t1 set s1=0x12 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x12345678 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x123457 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x1220 where a=1;
+select hex(s1) from t2;
+hex(s1)
+1220
+update t1 set s1=0x1200 where a=1;
+select hex(s1) from t2;
+hex(s1)
+1200
+update t1 set s1=0x4200 where a=1;
+select hex(s1) from t2;
+hex(s1)
+4200
+delete from t1 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+delete from t1 where a=2;
+update t2 set s1=0x4120;
+delete from t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+delete from t1 where a!=3;
+select a,hex(s1) from t1;
+a hex(s1)
+3 4120
+select hex(s1) from t2;
+hex(s1)
+4120
+drop table t2,t1;
+create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
+create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+insert into t1 values(1,0x4100),(2,0x41);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+hex(s1)
+41
+update t1 set s1=0x1234 where a=1;
+select hex(s1) from t2;
+hex(s1)
+41
+update t1 set s1=0x12 where a=2;
+select hex(s1) from t2;
+hex(s1)
+12
+delete from t1 where a=1;
+delete from t1 where a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+select a,hex(s1) from t1;
+a hex(s1)
+2 12
+select hex(s1) from t2;
+hex(s1)
+12
+drop table t2,t1;
+CREATE TABLE t1 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+hex(ind) hex(string1)
+0
+1
+select hex(ind),hex(string1) from t2 order by string1;
+hex(ind) hex(string1)
+0
+1
+drop table t1,t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
--- 1.77/mysql-test/r/variables.result 2005-11-23 21:47:25 +01:00
+++ 1.78/mysql-test/r/variables.result 2006-01-31 22:13:12 +01:00
@@ -537,10 +537,10 @@
create table t1 (a int);
select a into @x from t1;
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
show warnings;
Level Code Message
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
drop table t1;
set @@warning_count=1;
ERROR HY000: Variable 'warning_count' is a read only variable
--- 1.45/mysql-test/t/alter_table.test 2005-12-31 05:49:41 +01:00
+++ 1.46/mysql-test/t/alter_table.test 2006-01-31 22:50:13 +01:00
@@ -438,4 +438,11 @@
select * from t1;
alter table t1 add unique key (i, v);
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
+# Bug#6073 "ALTER table minor glich": ALTER TABLE complains that an index
+# without # prefix is not allowed for TEXT columns, while index
+# is defined with prefix.
+#
+create table t1 (t varchar(255) default null, key t (t(80)))
+engine=myisam default charset=latin1;
+alter table t1 change t t text;
drop table t1;
--- 1.124/mysql-test/t/innodb.test 2006-01-30 15:02:50 +01:00
+++ 1.125/mysql-test/t/innodb.test 2006-01-31 22:13:12 +01:00
@@ -1273,7 +1273,7 @@
# Test for innodb_thread_concurrency variable
show variables like "innodb_thread_concurrency";
-set global innodb_thread_concurrency=1000;
+set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
@@ -1610,6 +1610,10 @@
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
@@ -1639,6 +1643,10 @@
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
@@ -1668,6 +1676,10 @@
insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
@@ -1693,10 +1705,15 @@
insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
drop table t1;
drop table t2;
commit;
+
#
# Test that we can create a large (>1K) key
#
@@ -1714,4 +1731,166 @@
e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=innodb;
---echo End of 5.0 tests
+
+# test the padding of BINARY types and collations (Bug #14189)
+
+create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
+create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
+create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
+create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
+
+insert into t1 values (0x41),(0x4120),(0x4100);
+-- error 1062
+insert into t2 values (0x41),(0x4120),(0x4100);
+insert into t2 values (0x41),(0x4120);
+-- error 1062
+insert into t3 values (0x41),(0x4120),(0x4100);
+insert into t3 values (0x41),(0x4100);
+-- error 1062
+insert into t4 values (0x41),(0x4120),(0x4100);
+insert into t4 values (0x41),(0x4100);
+select hex(s1) from t1;
+select hex(s1) from t2;
+select hex(s1) from t3;
+select hex(s1) from t4;
+drop table t1,t2,t3,t4;
+
+create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
+create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+
+insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
+-- error 1452
+insert into t2 values(0x42);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x123456 where a=2;
+select hex(s1) from t2;
+-- error 1451
+update t1 set s1=0x12 where a=1;
+-- error 1451
+update t1 set s1=0x12345678 where a=1;
+-- error 1451
+update t1 set s1=0x123457 where a=1;
+update t1 set s1=0x1220 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x1200 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x4200 where a=1;
+select hex(s1) from t2;
+-- error 1451
+delete from t1 where a=1;
+delete from t1 where a=2;
+update t2 set s1=0x4120;
+-- error 1451
+delete from t1;
+delete from t1 where a!=3;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+
+create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
+create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+
+insert into t1 values(1,0x4100),(2,0x41);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x1234 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x12 where a=2;
+select hex(s1) from t2;
+delete from t1 where a=1;
+-- error 1451
+delete from t1 where a=2;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+#
+# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
+#
+CREATE TABLE t1 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+select hex(ind),hex(string1) from t2 order by string1;
+drop table t1,t2;
+
+# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
+
+create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
--- 1.251/sql/ha_innodb.cc 2006-01-30 15:02:50 +01:00
+++ 1.252/sql/ha_innodb.cc 2006-01-31 22:50:13 +01:00
@@ -166,7 +166,6 @@
/* Below we have boolean-valued start-up parameters, and their default
values */
-uint innobase_flush_log_at_trx_commit = 1;
ulong innobase_fast_shutdown = 1;
my_bool innobase_log_archive = FALSE;/* unused */
my_bool innobase_use_doublewrite = TRUE;
@@ -355,7 +354,7 @@
/*=========================*/
trx_t* trx) /* in: transaction handle */
{
- if (UNIV_LIKELY(srv_thread_concurrency >= SRV_CONCURRENCY_THRESHOLD)) {
+ if (UNIV_LIKELY(!srv_thread_concurrency)) {
return;
}
@@ -372,7 +371,7 @@
/*========================*/
trx_t* trx) /* in: transaction handle */
{
- if (UNIV_LIKELY(srv_thread_concurrency >= SRV_CONCURRENCY_THRESHOLD)) {
+ if (UNIV_LIKELY(!srv_thread_concurrency)) {
return;
}
@@ -1359,7 +1358,6 @@
srv_log_archive_on = (ulint) innobase_log_archive;
#endif /* UNIV_LOG_ARCHIVE */
srv_log_buffer_size = (ulint) innobase_log_buffer_size;
- srv_flush_log_at_trx_commit = (ulint) innobase_flush_log_at_trx_commit;
/* We set srv_pool_size here in units of 1 kB. InnoDB internally
changes the value so that it becomes the number of database pages. */
@@ -1409,6 +1407,7 @@
ut_a(DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL ==
my_charset_latin1.number);
+ ut_a(DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number);
/* Store the latin1_swedish_ci character ordering table to InnoDB. For
non-latin1_swedish_ci charsets we use the MySQL comparison functions,
@@ -1833,7 +1832,7 @@
trx->active_trans = 0;
- if (srv_flush_log_at_trx_commit == 0) {
+ if (UNIV_UNLIKELY(srv_flush_log_at_trx_commit == 0)) {
return(0);
}
@@ -2870,8 +2869,6 @@
char* buff_start = buff;
enum_field_types mysql_type;
Field* field;
- ulint blob_len;
- byte* blob_data;
ibool is_null;
DBUG_ENTER("store_key_val_for_row");
@@ -2926,14 +2923,18 @@
ulint len;
byte* data;
ulint key_len;
+ ulint true_len;
CHARSET_INFO* cs;
int error=0;
+ key_len = key_part->length;
+
if (is_null) {
- buff += key_part->length + 2;
+ buff += key_len + 2;
continue;
}
+ cs = field->charset();
lenlen = (ulint)
(((Field_varstring*)field)->length_bytes);
@@ -2943,32 +2944,33 @@
+ (ulint)get_field_offset(table, field)),
lenlen);
- /* In a column prefix index, we may need to truncate
- the stored value: */
-
- cs = key_part->field->charset();
+ true_len = len;
- if (cs->mbmaxlen > 1 && key_part->length > 0) {
- key_len = (ulint) cs->cset->well_formed_len(cs,
- (const char *) data,
- (const char *) data + key_part->length,
- key_part->length / cs->mbmaxlen,
- &error);
- } else {
- key_len = key_part->length;
+ /* For multi byte character sets we need to calculate
+ the true length of the key */
+
+ if (len > 0 && cs->mbmaxlen > 1) {
+ true_len = (ulint) cs->cset->well_formed_len(cs,
+ (const char *) data,
+ (const char *) data + len,
+ key_len / cs->mbmaxlen,
+ &error);
}
- if (len > key_len) {
- len = key_len;
+ /* In a column prefix index, we may need to truncate
+ the stored value: */
+
+ if (true_len > key_len) {
+ true_len = key_len;
}
/* The length in a key value is always stored in 2
bytes */
- row_mysql_store_true_var_len((byte*)buff, len, 2);
+ row_mysql_store_true_var_len((byte*)buff, true_len, 2);
buff += 2;
- memcpy(buff, data, len);
+ memcpy(buff, data, true_len);
/* Note that we always reserve the maximum possible
length of the true VARCHAR in the key value, though
@@ -2976,7 +2978,7 @@
actual data. The rest of the space was reset to zero
in the bzero() call above. */
- buff += key_part->length;
+ buff += key_len;
} else if (mysql_type == FIELD_TYPE_TINY_BLOB
|| mysql_type == FIELD_TYPE_MEDIUM_BLOB
@@ -2986,58 +2988,66 @@
CHARSET_INFO* cs;
ulint key_len;
ulint len;
+ ulint true_len;
int error=0;
+ ulint blob_len;
+ byte* blob_data;
ut_a(key_part->key_part_flag & HA_PART_KEY_SEG);
+ key_len = key_part->length;
+
if (is_null) {
- buff += key_part->length + 2;
+ buff += key_len + 2;
continue;
}
+ cs = field->charset();
+
blob_data = row_mysql_read_blob_ref(&blob_len,
(byte*) (record
+ (ulint)get_field_offset(table, field)),
(ulint) field->pack_length());
+ true_len = blob_len;
+
ut_a(get_field_offset(table, field)
== key_part->offset);
+ /* For multi byte character sets we need to calculate
+ the true length of the key */
+
+ if (blob_len > 0 && cs->mbmaxlen > 1) {
+ true_len = (ulint) cs->cset->well_formed_len(cs,
+ (const char *) blob_data,
+ (const char *) blob_data
+ + blob_len,
+ key_len / cs->mbmaxlen,
+ &error);
+ }
+
/* All indexes on BLOB and TEXT are column prefix
indexes, and we may need to truncate the data to be
stored in the key value: */
- cs = key_part->field->charset();
-
- if (cs->mbmaxlen > 1 && key_part->length > 0) {
- key_len = (ulint) cs->cset->well_formed_len(cs,
- (const char *) blob_data,
- (const char *) blob_data
- + key_part->length,
- key_part->length / cs->mbmaxlen,
- &error);
- } else {
- key_len = key_part->length;
- }
-
- if (blob_len > key_len) {
- blob_len = key_len;
+ if (true_len > key_len) {
+ true_len = key_len;
}
/* MySQL reserves 2 bytes for the length and the
storage of the number is little-endian */
innobase_write_to_2_little_endian(
- (byte*)buff, (ulint)blob_len);
+ (byte*)buff, true_len);
buff += 2;
- memcpy(buff, blob_data, blob_len);
+ memcpy(buff, blob_data, true_len);
/* Note that we always reserve the maximum possible
length of the BLOB prefix in the key value. */
- buff += key_part->length;
+ buff += key_len;
} else {
/* Here we handle all other data types except the
true VARCHAR, BLOB and TEXT. Note that the column
@@ -3045,34 +3055,53 @@
index. */
CHARSET_INFO* cs;
- ulint len;
+ ulint true_len;
+ ulint key_len;
const mysql_byte* src_start;
int error=0;
+ enum_field_types real_type;
+
+ key_len = key_part->length;
if (is_null) {
- buff += key_part->length;
+ buff += key_len;
continue;
}
- /* In a column prefix index, we may need to truncate
- the stored value: */
-
- cs = key_part->field->charset();
src_start = record + key_part->offset;
+ real_type = field->real_type();
+ true_len = key_len;
- if (key_part->length > 0 && cs->mbmaxlen > 1) {
- len = (ulint) cs->cset->well_formed_len(cs,
- (const char *) src_start,
- (const char *) src_start + key_part->length,
- key_part->length / cs->mbmaxlen,
- &error);
- } else {
- len = key_part->length;
+ /* Character set for the field is defined only
+ to fields whose type is string and real field
+ type is not enum or set. For these fields check
+ if character set is multi byte. */
+
+ if (real_type != FIELD_TYPE_ENUM
+ && real_type != FIELD_TYPE_SET
+ && ( mysql_type == MYSQL_TYPE_VAR_STRING
+ || mysql_type == MYSQL_TYPE_STRING)) {
+
+ cs = field->charset();
+
+ /* For multi byte character sets we need to
+ calculate the true length of the key */
+
+ if (key_len > 0 && cs->mbmaxlen > 1) {
+
+ true_len = (ulint)
+ cs->cset->well_formed_len(cs,
+ (const char *)src_start,
+ (const char *)src_start
+ + key_len,
+ key_len / cs->mbmaxlen,
+ &error);
+ }
}
- memcpy(buff, src_start, len);
- buff+=len;
+ memcpy(buff, src_start, true_len);
+ buff += true_len;
/* Pad the unused space with spaces. Note that no
padding is ever needed for UCS-2 because in MySQL,
@@ -3080,10 +3109,10 @@
support surrogate pairs, which are needed to represent
characters in the range U+10000 to U+10FFFF. */
- if (len < key_part->length) {
- len = key_part->length - len;
- memset(buff, ' ', len);
- buff+=len;
+ if (true_len < key_len) {
+ ulint pad_len = key_len - true_len;
+ memset(buff, ' ', pad_len);
+ buff += pad_len;
}
}
}
@@ -3861,6 +3890,9 @@
} else {
prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
}
+
+ DBUG_VOID_RETURN;
+
}
/**********************************************************************
--- 1.115/sql/ha_innodb.h 2006-01-07 14:41:40 +01:00
+++ 1.116/sql/ha_innodb.h 2006-01-31 22:13:13 +01:00
@@ -214,7 +214,6 @@
extern SHOW_VAR innodb_status_variables[];
extern uint innobase_init_flags, innobase_lock_type;
-extern uint innobase_flush_log_at_trx_commit;
extern ulong innobase_cache_size, innobase_fast_shutdown;
extern ulong innobase_large_page_size;
extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
@@ -252,6 +251,7 @@
extern ulong srv_thread_sleep_delay;
extern ulong srv_thread_concurrency;
extern ulong srv_commit_concurrency;
+extern ulong srv_flush_log_at_trx_commit;
}
extern TYPELIB innobase_lock_typelib;
--- 1.162/sql/set_var.cc 2006-01-30 13:09:02 +01:00
+++ 1.163/sql/set_var.cc 2006-01-31 22:50:13 +01:00
@@ -475,6 +475,9 @@
&srv_thread_concurrency);
sys_var_long_ptr sys_innodb_commit_concurrency("innodb_commit_concurrency",
&srv_commit_concurrency);
+sys_var_long_ptr sys_innodb_flush_log_at_trx_commit(
+ "innodb_flush_log_at_trx_commit",
+ &srv_flush_log_at_trx_commit);
/* Condition pushdown to storage engine */
sys_var_thd_bool
@@ -767,6 +770,7 @@
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONGLONG },
{"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL},
{sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency, SHOW_SYS},
+ {sys_innodb_flush_log_at_trx_commit.name, (char*) &sys_innodb_flush_log_at_trx_commit, SHOW_SYS},
{sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS},
{"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR},
{"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR},
@@ -774,7 +778,6 @@
{sys_innodb_fast_shutdown.name,(char*) &sys_innodb_fast_shutdown, SHOW_SYS},
{"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
{"innodb_file_per_table", (char*) &innobase_file_per_table, SHOW_MY_BOOL},
- {"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_INT},
{"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
{"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
{"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
@@ -2495,7 +2498,6 @@
bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
{
- pthread_mutex_t *lock_log= mysql_bin_log.get_log_lock();
sync_binlog_period= (ulong) var->save_result.ulonglong_value;
return 0;
}
--- 1.176/client/mysqltest.c 2006-01-31 13:07:42 +01:00
+++ 1.177/client/mysqltest.c 2006-01-31 22:13:11 +01:00
@@ -2500,19 +2500,8 @@
*create_conn= 0;
goto err;
}
- else
- {
- handle_no_error(q);
- /*
- Fail if there was no error but we expected it.
- We also don't want to have connection in this case.
- */
- mysql_close(con);
- *create_conn= 0;
- error= 1;
- goto err;
- }
+ handle_no_error(q);
/*
TODO: change this to 0 in future versions, but the 'kill' test relies on
--- 1.99/mysql-test/r/sp-error.result 2006-01-17 19:10:41 +01:00
+++ 1.100/mysql-test/r/sp-error.result 2006-01-31 22:13:12 +01:00
@@ -464,19 +464,6 @@
call bug3294()|
ERROR 42S02: Unknown table 't5'
drop procedure bug3294|
-drop procedure if exists bug6807|
-create procedure bug6807()
-begin
-declare id int;
-set id = connection_id();
-kill query id;
-select 'Not reached';
-end|
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-drop procedure bug6807|
drop procedure if exists bug8776_1|
drop procedure if exists bug8776_2|
drop procedure if exists bug8776_3|
--- 1.180/mysql-test/r/sp.result 2006-01-19 10:28:59 +01:00
+++ 1.181/mysql-test/r/sp.result 2006-01-31 22:13:12 +01:00
@@ -522,7 +522,7 @@
create table t3 ( s char(16), d int)|
call into_test4()|
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
select * from t3|
s d
into4 NULL
@@ -1787,10 +1787,10 @@
call bug1863(10)|
Warnings:
Note 1051 Unknown table 'temp_t1'
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
call bug1863(10)|
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
select * from t4|
f1 rc t3
2 0 NULL
@@ -2084,10 +2084,10 @@
call bug4579_1()|
call bug4579_1()|
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
call bug4579_1()|
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
drop procedure bug4579_1|
drop procedure bug4579_2|
drop table t3|
@@ -2505,7 +2505,7 @@
var
NULL
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
call bug7743("anotherword")|
var
2
@@ -2513,7 +2513,7 @@
var
NULL
Warnings:
-Warning 1329 No data to FETCH
+Warning 1329 No data - zero rows fetched, selected, or processed
drop procedure bug7743|
drop table t4|
delete from t3|
@@ -3552,8 +3552,6 @@
drop procedure if exists bug7049_2|
drop procedure if exists bug7049_3|
drop procedure if exists bug7049_4|
-drop procedure if exists bug7049_5|
-drop procedure if exists bug7049_6|
drop function if exists bug7049_1|
drop function if exists bug7049_2|
create table t3 ( x int unique )|
@@ -3578,18 +3576,6 @@
call bug7049_3();
select 'Missed it' as 'Result';
end|
-create procedure bug7049_5()
-begin
-declare x decimal(2,1);
-set x = 'zap';
-end|
-create procedure bug7049_6()
-begin
-declare exit handler for sqlwarning
-select 'Caught it' as 'Result';
-call bug7049_5();
-select 'Missed it' as 'Result';
-end|
create function bug7049_1()
returns int
begin
@@ -3619,9 +3605,6 @@
select * from t3|
x
42
-call bug7049_6()|
-Result
-Caught it
select bug7049_2()|
bug7049_2()
1
@@ -3630,8 +3613,6 @@
drop procedure bug7049_2|
drop procedure bug7049_3|
drop procedure bug7049_4|
-drop procedure bug7049_5|
-drop procedure bug7049_6|
drop function bug7049_1|
drop function bug7049_2|
drop function if exists bug13941|
@@ -4313,4 +4294,143 @@
2 NULL
drop table t3|
drop procedure bug15441|
+drop procedure if exists bug14498_1|
+drop procedure if exists bug14498_2|
+drop procedure if exists bug14498_3|
+drop procedure if exists bug14498_4|
+drop procedure if exists bug14498_5|
+create procedure bug14498_1()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+if v then
+select 'yes' as 'v';
+else
+select 'no' as 'v';
+end if;
+select 'done' as 'End';
+end|
+create procedure bug14498_2()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+while v do
+select 'yes' as 'v';
+end while;
+select 'done' as 'End';
+end|
+create procedure bug14498_3()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+repeat
+select 'maybe' as 'v';
+until v end repeat;
+select 'done' as 'End';
+end|
+create procedure bug14498_4()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+case v
+when 1 then
+select '1' as 'v';
+when 2 then
+select '2' as 'v';
+else
+select '?' as 'v';
+end case;
+select 'done' as 'End';
+end|
+create procedure bug14498_5()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+case
+when v = 1 then
+select '1' as 'v';
+when v = 2 then
+select '2' as 'v';
+else
+select '?' as 'v';
+end case;
+select 'done' as 'End';
+end|
+call bug14498_1()|
+Handler
+error
+End
+done
+call bug14498_2()|
+Handler
+error
+End
+done
+call bug14498_3()|
+v
+maybe
+Handler
+error
+End
+done
+call bug14498_5()|
+Handler
+error
+End
+done
+drop procedure bug14498_1|
+drop procedure bug14498_2|
+drop procedure bug14498_3|
+drop procedure bug14498_4|
+drop procedure bug14498_5|
+drop table if exists t3|
+drop procedure if exists bug15231_1|
+drop procedure if exists bug15231_2|
+drop procedure if exists bug15231_3|
+drop procedure if exists bug15231_4|
+create table t3 (id int not null)|
+create procedure bug15231_1()
+begin
+declare xid integer;
+declare xdone integer default 0;
+declare continue handler for not found set xdone = 1;
+set xid=null;
+call bug15231_2(xid);
+select xid, xdone;
+end|
+create procedure bug15231_2(inout ioid integer)
+begin
+select "Before NOT FOUND condition is triggered" as '1';
+select id into ioid from t3 where id=ioid;
+select "After NOT FOUND condtition is triggered" as '2';
+if ioid is null then
+set ioid=1;
+end if;
+end|
+create procedure bug15231_3()
+begin
+declare exit handler for sqlwarning
+select 'Caught it (wrong)' as 'Result';
+call bug15231_4();
+end|
+create procedure bug15231_4()
+begin
+declare x decimal(2,1);
+set x = 'zap';
+select 'Missed it (correct)' as 'Result';
+end|
+call bug15231_1()|
+1
+Before NOT FOUND condition is triggered
+2
+After NOT FOUND condtition is triggered
+xid xdone
+1 0
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+call bug15231_3()|
+Result
+Missed it (correct)
+Warnings:
+Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
+drop table if exists t3|
+drop procedure if exists bug15231_1|
+drop procedure if exists bug15231_2|
+drop procedure if exists bug15231_3|
+drop procedure if exists bug15231_4|
drop table t1,t2;
--- 1.170/mysql-test/t/sp.test 2006-01-17 12:44:48 +01:00
+++ 1.171/mysql-test/t/sp.test 2006-01-31 22:13:12 +01:00
@@ -1444,11 +1444,11 @@
call ifac(20)|
select * from fac|
drop table fac|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show function status like '%f%'|
drop procedure ifac|
drop function fac|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show function status like '%f%'|
@@ -1531,7 +1531,7 @@
end while;
end|
show create procedure opp|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like '%p%'|
# This isn't the fastest way in the world to compute prime numbers, so
@@ -1549,7 +1549,7 @@
drop table primes|
drop procedure opp|
drop procedure ip|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like '%p%'|
@@ -1617,13 +1617,13 @@
create procedure bar(x char(16), y int)
comment "111111111111" sql security invoker
insert into test.t1 values (x, y)|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like 'bar'|
alter procedure bar comment "2222222222" sql security definer|
alter procedure bar comment "3333333333"|
alter procedure bar|
show create procedure bar|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like 'bar'|
drop procedure bar|
@@ -2573,7 +2573,6 @@
show databases like 'foo';
show errors;
show columns from t1;
- show grants for 'root'@'localhost';
show keys from t1;
show open tables like 'foo';
show privileges;
@@ -2595,20 +2594,6 @@
drop procedure bug4902|
-# We need separate SP for SHOW PROCESSLIST since we want use replace_column
---disable_warnings
-drop procedure if exists bug4902_2|
---enable_warnings
-create procedure bug4902_2()
-begin
- show processlist;
-end|
---replace_column 1 # 6 # 3 localhost
-call bug4902_2()|
---replace_column 1 # 6 # 3 localhost
-call bug4902_2()|
-drop procedure bug4902_2|
-
#
# BUG#4904
#
@@ -2823,44 +2808,6 @@
delete from t1|
drop procedure bug4941|
-
-#
-# BUG#3583: query cache doesn't work for stored procedures
-#
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
-create procedure bug3583()
-begin
- declare c int;
-
- select * from t1;
- select count(*) into c from t1;
- select c;
-end|
-
-insert into t1 values ("x", 3), ("y", 5)|
-set @x = @@query_cache_size|
-set global query_cache_size = 10*1024*1024|
-
-flush status|
-flush query cache|
-show status like 'Qcache_hits'|
-call bug3583()|
-show status like 'Qcache_hits'|
-call bug3583()|
-call bug3583()|
-show status like 'Qcache_hits'|
-
-set global query_cache_size = @x|
-flush status|
-flush query cache|
-delete from t1|
-drop procedure bug3583|
-
#
# BUG#4905: Stored procedure doesn't clear for "Rows affected"
#
@@ -3170,24 +3117,6 @@
drop function bug5240|
#
-# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
-#
---disable_warnings
-drop function if exists bug5278|
---enable_warnings
-create function bug5278 () returns char
-begin
- SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
- return 'okay';
-end|
-
---error 1133
-select bug5278()|
---error 1133
-select bug5278()|
-drop function bug5278|
-
-#
# BUG#7992: rolling back temporary Item tree changes in SP
#
--disable_warnings
@@ -4208,9 +4137,13 @@
--error 1062
select bug12379()|
select 1|
+# statement-based binlogging will show warning which row-based won't;
+# so we hide it (this warning is already tested in rpl_stm_sp.test)
+--disable_warnings
call bug12379_1()|
select 2|
call bug12379_2()|
+--enable_warnings
select 3|
--error 1062
call bug12379_3()|
@@ -4784,24 +4717,6 @@
call bug10100t(5)|
#end of the stack checking
-set @@max_sp_recursion_depth=255|
-set @var=1|
-#disable log because error about stack overrun contains numbers which
-#depend on a system
--- disable_result_log
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100p(255, @var)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pt(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pv(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pd(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pc(1,255)|
--- enable_result_log
-set @@max_sp_recursion_depth=0|
-
deallocate prepare stmt2|
drop function bug10100f|
--- 1.195/sql/sp_head.cc 2006-01-16 15:37:22 +01:00
+++ 1.196/sql/sp_head.cc 2006-01-31 22:13:14 +01:00
@@ -174,11 +174,11 @@
case SQLCOM_SHOW_ERRORS:
case SQLCOM_SHOW_FIELDS:
case SQLCOM_SHOW_GRANTS:
- case SQLCOM_SHOW_INNODB_STATUS:
+ case SQLCOM_SHOW_ENGINE_STATUS:
+ case SQLCOM_SHOW_ENGINE_LOGS:
+ case SQLCOM_SHOW_ENGINE_MUTEX:
case SQLCOM_SHOW_KEYS:
- case SQLCOM_SHOW_LOGS:
case SQLCOM_SHOW_MASTER_STAT:
- case SQLCOM_SHOW_MUTEX_STATUS:
case SQLCOM_SHOW_NEW_MASTER:
case SQLCOM_SHOW_OPEN_TABLES:
case SQLCOM_SHOW_PRIVILEGES:
@@ -308,6 +308,9 @@
{
DBUG_ENTER("sp_eval_expr");
+ if (!expr_item)
+ DBUG_RETURN(TRUE);
+
if (!(expr_item= sp_prepare_func_item(thd, &expr_item)))
DBUG_RETURN(TRUE);
@@ -474,7 +477,7 @@
sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
{
DBUG_ENTER("sp_head::init_strings");
- uchar *endp; /* Used to trim the end */
+ const uchar *endp; /* Used to trim the end */
/* During parsing, we must use thd->mem_root */
MEM_ROOT *root= thd->mem_root;
@@ -675,7 +678,8 @@
field_length= !m_return_field_def.length ?
field_max_length : m_return_field_def.length;
- field= ::make_field((char*) 0, /* field ptr */
+ field= ::make_field(table->s, /* TABLE_SHARE ptr */
+ (char*) 0, /* field ptr */
field_length, /* field [max] length */
(uchar*) "", /* null ptr */
0, /* null bit */
@@ -685,8 +689,10 @@
m_return_field_def.geom_type,
Field::NONE, /* unreg check */
m_return_field_def.interval,
- field_name ? field_name : (const char *) m_name.str,
- table);
+ field_name ? field_name : (const char *) m_name.str);
+
+ if (field)
+ field->init(table);
DBUG_RETURN(field);
}
@@ -700,6 +706,9 @@
/*
StoredRoutinesBinlogging
+ This paragraph applies only to statement-based binlogging. Row-based
+ binlogging does not need anything special like this.
+
Top-down overview:
1. Statements
@@ -1267,56 +1276,62 @@
thd->spcont= nctx;
- binlog_save_options= thd->options;
- need_binlog_call= mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG);
+ /*
+ If row-based binlogging, we don't need to binlog the function's call, let
+ each substatement be binlogged its way.
+ */
+ need_binlog_call= mysql_bin_log.is_open() &&
+ (thd->options & OPTION_BIN_LOG) && !binlog_row_based;
if (need_binlog_call)
{
reset_dynamic(&thd->user_var_events);
mysql_bin_log.start_union_events(thd);
+ binlog_save_options= thd->options;
+ thd->options&= ~OPTION_BIN_LOG;
}
-
- thd->options&= ~OPTION_BIN_LOG;
+
err_status= execute(thd);
- thd->options= binlog_save_options;
-
- if (need_binlog_call)
- mysql_bin_log.stop_union_events(thd);
- if (need_binlog_call && thd->binlog_evt_union.unioned_events)
+ if (need_binlog_call)
{
- char buf[256];
- String bufstr(buf, sizeof(buf), &my_charset_bin);
- bufstr.length(0);
- bufstr.append(STRING_WITH_LEN("DO "));
- append_identifier(thd, &bufstr, m_name.str, m_name.length);
- bufstr.append('(');
- for (uint i=0; i < argcount; i++)
+ mysql_bin_log.stop_union_events(thd);
+ thd->options= binlog_save_options;
+ if (thd->binlog_evt_union.unioned_events)
{
- String str_value_holder;
- String *str_value;
-
- if (i)
- bufstr.append(',');
-
- str_value= sp_get_item_value(param_values[i], &str_value_holder);
+ char buf[256];
+ String bufstr(buf, sizeof(buf), &my_charset_bin);
+ bufstr.length(0);
+ bufstr.append(STRING_WITH_LEN("DO "));
+ append_identifier(thd, &bufstr, m_name.str, m_name.length);
+ bufstr.append('(');
+ for (uint i=0; i < argcount; i++)
+ {
+ String str_value_holder;
+ String *str_value;
- if (str_value)
- bufstr.append(*str_value);
- else
- bufstr.append(STRING_WITH_LEN("NULL"));
- }
- bufstr.append(')');
-
- Query_log_event qinfo(thd, bufstr.ptr(), bufstr.length(),
- thd->binlog_evt_union.unioned_events_trans, FALSE);
- if (mysql_bin_log.write(&qinfo) &&
- thd->binlog_evt_union.unioned_events_trans)
- {
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
- "Invoked ROUTINE modified a transactional table but MySQL "
- "failed to reflect this change in the binary log");
+ if (i)
+ bufstr.append(',');
+
+ str_value= sp_get_item_value(param_values[i], &str_value_holder);
+
+ if (str_value)
+ bufstr.append(*str_value);
+ else
+ bufstr.append(STRING_WITH_LEN("NULL"));
+ }
+ bufstr.append(')');
+
+ Query_log_event qinfo(thd, bufstr.ptr(), bufstr.length(),
+ thd->binlog_evt_union.unioned_events_trans, FALSE);
+ if (mysql_bin_log.write(&qinfo) &&
+ thd->binlog_evt_union.unioned_events_trans)
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+ "Invoked ROUTINE modified a transactional table but MySQL "
+ "failed to reflect this change in the binary log");
+ }
+ reset_dynamic(&thd->user_var_events);
}
- reset_dynamic(&thd->user_var_events);
}
if (m_type == TYPE_ENUM_FUNCTION && !err_status)
--- 1.75/sql/sp_head.h 2006-01-16 15:25:36 +01:00
+++ 1.76/sql/sp_head.h 2006-01-31 22:13:14 +01:00
@@ -130,8 +130,7 @@
create_field m_return_field_def; /* This is used for FUNCTIONs only. */
- uchar *m_tmp_query; // Temporary pointer to sub query string
- uint m_old_cmq; // Old CLIENT_MULTI_QUERIES value
+ const uchar *m_tmp_query; // Temporary pointer to sub query string
st_sp_chistics *m_chistics;
ulong m_sql_mode; // For SHOW CREATE and execution
LEX_STRING m_qname; // db.name
@@ -179,7 +178,7 @@
*/
HASH m_sroutines;
// Pointers set during parsing
- uchar *m_param_begin, *m_param_end, *m_body_begin;
+ const uchar *m_param_begin, *m_param_end, *m_body_begin;
/*
Security context for stored routine which should be run under
--- 1.93/sql/slave.h 2005-12-22 05:10:54 +01:00
+++ 1.94/sql/slave.h 2006-01-31 22:13:14 +01:00
@@ -231,7 +231,7 @@
int init_slave();
void init_slave_skip_errors(const char* arg);
-bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache);
+int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache);
bool flush_relay_log_info(RELAY_LOG_INFO* rli);
int register_slave_on_master(MYSQL* mysql);
int terminate_slave_threads(MASTER_INFO* mi, int thread_mask,
--- 1.224/BitKeeper/etc/ignore 2006-01-31 04:58:13 +01:00
+++ 1.225/BitKeeper/etc/ignore 2006-01-31 22:13:02 +01:00
@@ -48,6 +48,7 @@
50
=6
BUILD/compile-pentium-maintainer
+BitKeeper/etc/RESYNC_TREE
BitKeeper/etc/config
BitKeeper/etc/csets
BitKeeper/etc/csets-in
@@ -295,6 +296,7 @@
libmysql/*.vcproj
libmysql/conf_to_src
libmysql/debug/libmysql.exp
+libmysql/libmysql.ver
libmysql/my_static.h
libmysql/my_time.c
libmysql/mysys_priv.h
@@ -1611,4 +1613,3 @@
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
-BitKeeper/etc/RESYNC_TREE
--- 1.62/sql/repl_failsafe.cc 2005-11-23 13:04:09 +01:00
+++ 1.63/sql/repl_failsafe.cc 2006-01-31 22:13:14 +01:00
@@ -930,7 +930,8 @@
host was specified; there could have been a problem when replication
started, which led to relay log's IO_CACHE to not be inited.
*/
- flush_master_info(active_mi, 0);
+ if (flush_master_info(active_mi, 0))
+ sql_print_error("Failed to flush master info file");
}
mysql_free_result(master_status_res);
}
--- 1.148/sql/sql_repl.cc 2006-01-12 19:50:32 +01:00
+++ 1.149/sql/sql_repl.cc 2006-01-31 22:50:13 +01:00
@@ -1201,7 +1201,12 @@
Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
a slave before).
*/
- flush_master_info(mi, 0);
+ if (flush_master_info(mi, 0))
+ {
+ my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
+ unlock_slave_threads(mi);
+ DBUG_RETURN(TRUE);
+ }
if (need_relay_log_purge)
{
relay_log_purge= 1;
@@ -1311,13 +1316,14 @@
bool ret = TRUE;
IO_CACHE log;
File file = -1;
- Format_description_log_event *description_event= new
- Format_description_log_event(3); /* MySQL 4.0 by default */
Log_event::init_show_field_list(&field_list);
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
+
+ Format_description_log_event *description_event= new
+ Format_description_log_event(3); /* MySQL 4.0 by default */
/*
Wait for handlers to insert any pending information
--- 1.79/sql/sql_handler.cc 2006-01-16 14:26:27 +01:00
+++ 1.80/sql/sql_handler.cc 2006-01-31 22:13:15 +01:00
@@ -422,12 +422,13 @@
if (!lock)
goto err0; // mysql_lock_tables() printed error message already
- if (cond && ((!cond->fixed &&
- cond->fix_fields(thd, &cond)) || cond->check_cols(1)))
+ if (cond)
{
if (table->query_id != thd->query_id)
cond->cleanup(); // File was reopened
- goto err0;
+ if ((!cond->fixed &&
+ cond->fix_fields(thd, &cond)) || cond->check_cols(1))
+ goto err0;
}
if (keyname)
--- 1.169/tests/mysql_client_test.c 2006-01-30 10:57:34 +01:00
+++ 1.170/tests/mysql_client_test.c 2006-01-31 22:50:13 +01:00
@@ -14623,7 +14623,6 @@
myquery(rc);
}
-
/* Test MYSQL_OPT_RECONNECT, Bug#15719 */
static void test_opt_reconnect()
@@ -14697,6 +14696,23 @@
mysql_close(lmysql);
}
+/* Bug #16144: mysql_stmt_attr_get type error */
+
+static void test_bug16144()
+{
+ const my_bool flag_orig= (my_bool) 0xde;
+ my_bool flag= flag_orig;
+ MYSQL_STMT *stmt;
+ myheader("test_bug16144");
+
+ /* Check that attr_get returns correct data on little and big endian CPUs */
+ stmt= mysql_stmt_init(mysql);
+ mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (const void*) &flag);
+ mysql_stmt_attr_get(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &flag);
+ DIE_UNLESS(flag == flag_orig);
+
+ mysql_stmt_close(stmt);
+}
/*
Read and parse arguments and MySQL options from my.cnf
@@ -14959,6 +14975,7 @@
{ "test_bug14845", test_bug14845 },
{ "test_bug15510", test_bug15510 },
{ "test_opt_reconnect", test_opt_reconnect },
+ { "test_bug16144", test_bug16144 },
{ 0, 0 }
};
--- 1.51/sql/sql_help.cc 2005-11-04 21:09:56 +01:00
+++ 1.52/sql/sql_help.cc 2006-01-31 22:13:15 +01:00
@@ -567,7 +567,7 @@
SQL_SELECT *res= make_select(table, 0, 0, cond, 0, error);
if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)) ||
- (res->quick && res->quick->reset()))
+ (res && res->quick && res->quick->reset()))
{
delete res;
res=0;
| Thread |
|---|
| • bk commit into 5.1 tree (knielsen:1.2114) | knielsen | 31 Jan |