Below is the list of changes that have just been committed into a local
5.1 repository of root. When root does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-08-15 16:24:38+08:00, dli@stripped +119 -0
Merge dev3-76.dev.cn.tlan:/home/lisj/mysql/mysql-5.0/bug-19047
into dev3-76.dev.cn.tlan:/home/lisj/mysql/mysql-5.1/mysql-5.1-bug19047
MERGE: 1.1810.1697.121
BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.2.1.2
BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: mysql-test/t/im_options_set.imtest -> BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833
BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.4.1.2
BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: mysql-test/r/im_options_set.result -> BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921
BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.2.1.2
BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: mysql-test/t/im_options_unset.imtest -> BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048
BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.4.1.2
BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: mysql-test/r/im_options_unset.result -> BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f
BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.36.1.10
BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: VC++Files/sql/mysqld.dsp -> BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56
BitKeeper/deleted/.del-mysys.dsp~32695fee91189326@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.30.1.2
BitKeeper/deleted/.del-mysys.dsp~32695fee91189326@stripped, 2006-08-15 16:21:09+08:00, dli@stripped +0 -0
Merge rename: VC++Files/mysys/mysys.dsp -> BitKeeper/deleted/.del-mysys.dsp~32695fee91189326
BitKeeper/etc/ignore@stripped, 2006-08-15 16:21:05+08:00, dli@stripped +1 -1
auto-union
MERGE: 1.210.1.18
client/Makefile.am@stripped, 2006-08-15 16:23:27+08:00, dli@stripped +0 -3
MERGE: 1.52.1.4
client/mysql.cc@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.199.1.14
client/mysqlbinlog.cc@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.123.1.5
client/mysqlcheck.c@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.55.1.2
client/mysqldump.c@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.214.1.23
client/mysqlimport.c@stripped, 2006-08-15 16:23:28+08:00, dli@stripped +0 -1
MERGE: 1.58.1.2
client/mysqltest.c@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.155.9.49
configure.in@stripped, 2006-08-15 16:23:24+08:00, dli@stripped +6 -9
MERGE: 1.245.1.151
dbug/dbug.c@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.21.2.2
extra/perror.c@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.39.1.6
extra/yassl/src/yassl_imp.cpp@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.8.1.2
extra/yassl/src/yassl_int.cpp@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.19.1.2
include/mysql.h@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.154.1.6
include/mysql_com.h@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.100.1.4
libmysql/libmysql.c@stripped, 2006-08-15 16:21:11+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.233.1.14
mysql-test/mysql-test-run.pl@stripped, 2006-08-15 16:23:30+08:00, dli@stripped +9 -48
MERGE: 1.30.1.79
mysql-test/r/cast.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.39.1.7
mysql-test/r/date_formats.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.18.1.10
mysql-test/r/federated.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.25.1.12
mysql-test/r/func_compress.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.17.1.1
mysql-test/r/func_group.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.46.1.8
mysql-test/r/func_time.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.47.1.16
mysql-test/r/gis-rtree.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.14.1.4
mysql-test/r/gis.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.33.1.2
mysql-test/r/im_daemon_life_cycle.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.2.1.2
mysql-test/r/im_life_cycle.result@stripped, 2006-08-15 16:23:32+08:00, dli@stripped +8 -3
MERGE: 1.3.1.4
mysql-test/r/im_utils.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.1.1.3
mysql-test/r/join_outer.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.44.1.5
mysql-test/r/mysqlcheck.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.1.1.1
mysql-test/r/mysqldump.result@stripped, 2006-08-15 16:23:34+08:00, dli@stripped +1 -18
MERGE: 1.83.1.26
mysql-test/r/mysqltest.result@stripped, 2006-08-15 16:23:35+08:00, dli@stripped +0 -6
MERGE: 1.24.1.11
mysql-test/r/ndb_basic.result@stripped, 2006-08-15 16:23:37+08:00, dli@stripped +0 -1
MERGE: 1.28.1.7
mysql-test/r/ps.result@stripped, 2006-08-15 16:23:39+08:00, dli@stripped +121 -141
MERGE: 1.56.1.15
mysql-test/r/rpl_sp.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.13.2.4
mysql-test/r/rpl_trigger.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.4.1.5
mysql-test/r/rpl_view.result@stripped, 2006-08-15 16:23:41+08:00, dli@stripped +0 -37
MERGE: 1.3.1.2
mysql-test/r/show_check.result@stripped, 2006-08-15 16:23:43+08:00, dli@stripped +0 -4
MERGE: 1.75.1.3
mysql-test/r/sp-code.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -2
Auto merged
MERGE: 1.5.1.2
mysql-test/r/sp-error.result@stripped, 2006-08-15 16:23:45+08:00, dli@stripped +0 -13
MERGE: 1.102.1.5
mysql-test/r/sp-security.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.25.1.6
mysql-test/r/sp.result@stripped, 2006-08-15 16:23:47+08:00, dli@stripped +0 -180
MERGE: 1.170.1.36
mysql-test/r/strict.result@stripped, 2006-08-15 16:21:12+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.25.1.3
mysql-test/r/type_blob.result@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.49.2.2
mysql-test/r/type_datetime.result@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.30.1.1
mysql-test/r/type_ranges.result@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.38.1.4
mysql-test/r/udf.result@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.3.1.4
mysql-test/r/union.result@stripped, 2006-08-15 16:23:49+08:00, dli@stripped +0 -6
MERGE: 1.80.1.5
mysql-test/r/user_var.result@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.37.1.2
mysql-test/t/cast.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.31.1.1
mysql-test/t/disabled.def@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.2.4.13
mysql-test/t/func_group.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.45.1.5
mysql-test/t/func_time.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.41.1.10
mysql-test/t/im_daemon_life_cycle.imtest@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.1.1.2
mysql-test/t/im_life_cycle.imtest@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.3.1.3
mysql-test/t/im_utils.imtest@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.1.1.2
mysql-test/t/mysql.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.4.1.9
mysql-test/t/mysqlbinlog.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.21.1.11
mysql-test/t/mysqlcheck.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.1.1.1
mysql-test/t/mysqldump.test@stripped, 2006-08-15 16:23:51+08:00, dli@stripped +0 -43
MERGE: 1.76.1.23
mysql-test/t/mysqltest.test@stripped, 2006-08-15 16:23:53+08:00, dli@stripped +0 -15
MERGE: 1.24.1.20
mysql-test/t/ndb_basic.test@stripped, 2006-08-15 16:23:55+08:00, dli@stripped +0 -10
MERGE: 1.32.1.4
mysql-test/t/ps.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.56.1.12
mysql-test/t/rpl_sp.test@stripped, 2006-08-15 16:23:57+08:00, dli@stripped +0 -80
MERGE: 1.9.2.3
mysql-test/t/rpl_trigger.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.4.1.4
mysql-test/t/rpl_view.test@stripped, 2006-08-15 16:23:59+08:00, dli@stripped +0 -84
MERGE: 1.3.1.1
mysql-test/t/show_check.test@stripped, 2006-08-15 16:24:01+08:00, dli@stripped +0 -11
MERGE: 1.54.1.4
mysql-test/t/sp-error.test@stripped, 2006-08-15 16:24:03+08:00, dli@stripped +0 -22
MERGE: 1.100.1.7
mysql-test/t/sp-security.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.28.1.6
mysql-test/t/sp.test@stripped, 2006-08-15 16:24:05+08:00, dli@stripped +0 -27
MERGE: 1.174.1.20
mysql-test/t/strict.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.19.1.3
mysql-test/t/udf.test@stripped, 2006-08-15 16:21:13+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.7.1.1
sql-common/client.c@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.83.1.13
sql-common/my_time.c@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.19.1.1
sql/field.cc@stripped, 2006-08-15 16:21:14+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.256.1.64
sql/item.cc@stripped, 2006-08-15 16:21:14+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.113.1.117
sql/item_func.cc@stripped, 2006-08-15 16:21:14+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.270.1.27
sql/item_func.h@stripped, 2006-08-15 16:21:14+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.136.2.9
sql/item_strfunc.cc@stripped, 2006-08-15 16:21:14+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.261.1.19
sql/item_strfunc.h@stripped, 2006-08-15 16:21:14+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.101.1.13
sql/item_subselect.cc@stripped, 2006-08-15 16:21:14+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.113.1.18
sql/item_sum.cc@stripped, 2006-08-15 16:24:07+08:00, dli@stripped +1 -0
MERGE: 1.170.1.9
sql/item_sum.h@stripped, 2006-08-15 16:21:15+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.102.1.1
sql/item_timefunc.cc@stripped, 2006-08-15 16:21:15+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.100.1.21
sql/mysql_priv.h@stripped, 2006-08-15 16:24:10+08:00, dli@stripped +2 -3
MERGE: 1.290.1.113
sql/mysqld.cc@stripped, 2006-08-15 16:21:15+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.439.1.125
sql/protocol.cc@stripped, 2006-08-15 16:21:15+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.111.1.3
sql/slave.cc@stripped, 2006-08-15 16:21:15+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.241.1.34
sql/sp.cc@stripped, 2006-08-15 16:21:16+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.82.1.33
sql/sp_head.cc@stripped, 2006-08-15 16:24:12+08:00, dli@stripped +38 -222
MERGE: 1.200.1.21
sql/sp_head.h@stripped, 2006-08-15 16:21:16+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.79.1.8
sql/sql_base.cc@stripped, 2006-08-15 16:21:16+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.235.1.112
sql/sql_class.h@stripped, 2006-08-15 16:21:16+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.230.1.63
sql/sql_db.cc@stripped, 2006-08-15 16:24:14+08:00, dli@stripped +8 -84
MERGE: 1.120.1.11
sql/sql_delete.cc@stripped, 2006-08-15 16:24:16+08:00, dli@stripped +0 -8
MERGE: 1.144.1.33
sql/sql_lex.cc@stripped, 2006-08-15 16:21:16+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.142.1.52
sql/sql_lex.h@stripped, 2006-08-15 16:24:18+08:00, dli@stripped +1 -1
MERGE: 1.175.1.50
sql/sql_parse.cc@stripped, 2006-08-15 16:21:17+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.426.1.137
sql/sql_prepare.cc@stripped, 2006-08-15 16:21:17+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.142.1.39
sql/sql_show.cc@stripped, 2006-08-15 16:24:19+08:00, dli@stripped +41 -76
MERGE: 1.253.1.73
sql/sql_table.cc@stripped, 2006-08-15 16:24:23+08:00, dli@stripped +0 -3
MERGE: 1.239.1.81
sql/sql_trigger.cc@stripped, 2006-08-15 16:24:25+08:00, dli@stripped +38 -7
MERGE: 1.35.1.19
sql/sql_udf.cc@stripped, 2006-08-15 16:21:17+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.45.1.14
sql/sql_view.cc@stripped, 2006-08-15 16:24:27+08:00, dli@stripped +38 -13
MERGE: 1.78.1.16
sql/sql_yacc.yy@stripped, 2006-08-15 16:24:29+08:00, dli@stripped +10 -32
MERGE: 1.371.1.108
sql/table.cc@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.160.1.71
sql/table.h@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.102.1.31
storage/ndb/src/kernel/error/ndbd_exit_codes.c@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.1.5.2
storage/ndb/src/kernel/error/ndbd_exit_codes.c@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: ndb/src/kernel/error/ndbd_exit_codes.c -> storage/ndb/src/kernel/error/ndbd_exit_codes.c
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.49.11.2
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: ndb/src/mgmclient/CommandInterpreter.cpp -> storage/ndb/src/mgmclient/CommandInterpreter.cpp
storage/ndb/src/mgmclient/main.cpp@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.20.3.2
storage/ndb/src/mgmclient/main.cpp@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: ndb/src/mgmclient/main.cpp -> storage/ndb/src/mgmclient/main.cpp
storage/ndb/src/mgmclient/ndb_mgmclient.hpp@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.13.1.2
storage/ndb/src/mgmclient/ndb_mgmclient.hpp@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: ndb/src/mgmclient/ndb_mgmclient.hpp -> storage/ndb/src/mgmclient/ndb_mgmclient.hpp
storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2006-08-15 16:21:18+08:00, dli@stripped +0 -0
Auto merged
MERGE: 1.60.13.5
storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2006-08-15 16:21:10+08:00, dli@stripped +0 -0
Merge rename: ndb/src/mgmsrv/ConfigInfo.cpp -> storage/ndb/src/mgmsrv/ConfigInfo.cpp
tests/mysql_client_test.c@stripped, 2006-08-15 16:24:31+08:00, dli@stripped +2 -96
MERGE: 1.167.1.28
# 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: dli
# Host: dev3-76.dev.cn.tlan
# Root: /home/lisj/mysql/mysql-5.1/mysql-5.1-bug19047/RESYNC
--- 1.219/client/mysql.cc 2006-08-15 16:24:52 +08:00
+++ 1.220/client/mysql.cc 2006-08-15 16:24:52 +08:00
@@ -2884,7 +2884,7 @@
bzero(buff, sizeof(buff));
if (buffer)
{
- strmov(buff, line);
+ strmake(buff, line, sizeof(buff));
tmp= get_arg(buff, 0);
if (tmp && *tmp)
{
@@ -3737,6 +3737,9 @@
break;
case 't':
processed_prompt.append('\t');
+ break;
+ case 'l':
+ processed_prompt.append(delimiter_str);
break;
default:
processed_prompt.append(c);
--- 1.243/client/mysqldump.c 2006-08-15 16:24:52 +08:00
+++ 1.244/client/mysqldump.c 2006-08-15 16:24:52 +08:00
@@ -84,7 +84,8 @@
static char *alloc_query_str(ulong size);
static char *field_escape(char *to,const char *from,uint length);
-static my_bool verbose=0,tFlag=0,dFlag=0,quick= 1, extended_insert= 1,
+static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
+ quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,
opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
@@ -100,7 +101,7 @@
opt_events= 0,
opt_alltspcs=0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
-static MYSQL mysql_connection,*sock=0;
+static MYSQL mysql_connection,*mysql=0;
static my_bool insert_pat_inited=0;
static DYNAMIC_STRING insert_pat;
static char *opt_password=0,*current_user=0,
@@ -322,9 +323,10 @@
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"no-create-info", 't', "Don't write table creation info.",
- (gptr*) &tFlag, (gptr*) &tFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ (gptr*) &opt_no_create_info, (gptr*) &opt_no_create_info, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-data", 'd', "No row information.", (gptr*) &opt_no_data,
+ (gptr*) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',
"Deprecated. Use --skip-set-charset instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -440,6 +442,30 @@
#include <help_start.h>
/*
+ Print the supplied message if in verbose mode
+
+ SYNOPSIS
+ verbose_msg()
+ fmt format specifier
+ ... variable number of parameters
+*/
+
+static void verbose_msg(const char *fmt, ...)
+{
+ va_list args;
+ DBUG_ENTER("verbose_msg");
+
+ if (!verbose)
+ DBUG_VOID_RETURN;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+
+ DBUG_VOID_RETURN;
+}
+
+/*
exit with message if ferror(file)
SYNOPSIS
@@ -578,6 +604,13 @@
fprintf(sql_file,
"/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n");
fputs("\n", sql_file);
+ if (opt_comments)
+ {
+ char time_str[20];
+ get_date(time_str, GETDATE_DATE_TIME, 0);
+ fprintf(sql_file, "-- Dump completed on %s\n",
+ time_str);
+ }
check_io(sql_file);
}
} /* write_footer */
@@ -857,9 +890,9 @@
if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con))))
{
- my_printf_error(0, "%s: Couldn't execute '%s': %s (%d)",
- MYF(0), my_progname, query,
- mysql_error(mysql_con), mysql_errno(mysql_con));
+ my_printf_error(0, "Couldn't execute '%s': %s (%d)", MYF(0),
+ query, mysql_error(mysql_con), mysql_errno(mysql_con));
+ safe_exit(EX_MYSQLERR);
return 1;
}
return 0;
@@ -893,8 +926,8 @@
first_error= error;
if (ignore_errors)
return;
- if (sock)
- mysql_close(sock);
+ if (mysql)
+ mysql_close(mysql);
exit(error);
}
/* safe_exit */
@@ -907,10 +940,8 @@
{
char buff[20+FN_REFLEN];
DBUG_ENTER("dbConnect");
- if (verbose)
- {
- fprintf(stderr, "-- Connecting to %s...\n", host ? host : "localhost");
- }
+
+ verbose_msg("-- Connecting to %s...\n", host ? host : "localhost");
mysql_init(&mysql_connection);
if (opt_compress)
mysql_options(&mysql_connection,MYSQL_OPT_COMPRESS,NullS);
@@ -928,7 +959,7 @@
mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
- if (!(sock= mysql_real_connect(&mysql_connection,host,user,passwd,
+ if (!(mysql= mysql_real_connect(&mysql_connection,host,user,passwd,
NULL,opt_mysql_port,opt_mysql_unix_port,
0)))
{
@@ -944,12 +975,11 @@
As we're going to set SQL_MODE, it would be lost on reconnect, so we
cannot reconnect.
*/
- sock->reconnect= 0;
+ mysql->reconnect= 0;
my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */",
compatible_mode_normal_str);
- if (mysql_query_with_error_report(sock, 0, buff))
+ if (mysql_query_with_error_report(mysql, 0, buff))
{
- mysql_close(sock);
safe_exit(EX_MYSQLERR);
return 1;
}
@@ -960,9 +990,8 @@
if (opt_tz_utc)
{
my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */");
- if (mysql_query_with_error_report(sock, 0, buff))
+ if (mysql_query_with_error_report(mysql, 0, buff))
{
- mysql_close(sock);
safe_exit(EX_MYSQLERR);
return 1;
}
@@ -976,9 +1005,8 @@
*/
static void dbDisconnect(char *host)
{
- if (verbose)
- fprintf(stderr, "-- Disconnecting from %s...\n", host ? host : "localhost");
- mysql_close(sock);
+ verbose_msg("-- Disconnecting from %s...\n", host ? host : "localhost");
+ mysql_close(mysql);
} /* dbDisconnect */
@@ -1398,7 +1426,7 @@
DBUG_ENTER("dump_routines_for_db");
DBUG_PRINT("enter", ("db: '%s'", db));
- mysql_real_escape_string(sock, db_name_buff, db, strlen(db));
+ mysql_real_escape_string(mysql, db_name_buff, db, strlen(db));
/* nice comments */
if (opt_comments)
@@ -1409,7 +1437,7 @@
enough privileges to lock mysql.proc.
*/
if (lock_tables)
- mysql_query(sock, "LOCK TABLES mysql.proc READ");
+ mysql_query(mysql, "LOCK TABLES mysql.proc READ");
fprintf(sql_file, "DELIMITER ;;\n");
@@ -1420,7 +1448,7 @@
"SHOW %s STATUS WHERE Db = '%s'",
routine_type[i], db_name_buff);
- if (mysql_query_with_error_report(sock, &routine_list_res, query_buff))
+ if (mysql_query_with_error_report(mysql, &routine_list_res, query_buff))
DBUG_RETURN(1);
if (mysql_num_rows(routine_list_res))
@@ -1434,7 +1462,7 @@
my_snprintf(query_buff, sizeof(query_buff), "SHOW CREATE %s %s",
routine_type[i], routine_name);
- if (mysql_query_with_error_report(sock, &routine_res, query_buff))
+ if (mysql_query_with_error_report(mysql, &routine_res, query_buff))
DBUG_RETURN(1);
while ((row= mysql_fetch_row(routine_res)))
@@ -1516,7 +1544,7 @@
fprintf(sql_file, "DELIMITER ;\n");
if (lock_tables)
- VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
+ VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
DBUG_RETURN(0);
}
@@ -1558,10 +1586,8 @@
if (delayed && (*ignore_flag & IGNORE_INSERT_DELAYED))
{
delayed= 0;
- if (verbose)
- fprintf(stderr,
- "-- Warning: Unable to use delayed inserts for table '%s' "
- "because it's of type %s\n", table, table_type);
+ verbose_msg("-- Warning: Unable to use delayed inserts for table '%s' "
+ "because it's of type %s\n", table, table_type);
}
complete_insert= 0;
@@ -1577,8 +1603,7 @@
insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
delayed ? " DELAYED " : opt_ignore ? " IGNORE " : "");
- if (verbose)
- fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
+ verbose_msg("-- Retrieving table structure for table %s...\n", table);
len= my_snprintf(query_buff, sizeof(query_buff),
"SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
@@ -1593,17 +1618,17 @@
if (opt_order_by_primary)
order_by = primary_key_fields(result_table);
- if (!opt_xml && !mysql_query_with_error_report(sock, 0, query_buff))
+ if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff))
{
/* using SHOW CREATE statement */
- if (!tFlag)
+ if (!opt_no_create_info)
{
/* Make an sql-file, if path was given iow. option -T was given */
char buff[20+FN_REFLEN];
MYSQL_FIELD *field;
my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
- if (mysql_query_with_error_report(sock, 0, buff))
+ if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
@@ -1639,14 +1664,13 @@
check_io(sql_file);
}
- result= mysql_store_result(sock);
+ result= mysql_store_result(mysql);
field= mysql_fetch_field_direct(result, 0);
if (strcmp(field->name, "View") == 0)
{
char *scv_buff = NULL;
- if (verbose)
- fprintf(stderr, "-- It's a view, create dummy table for view\n");
+ verbose_msg("-- It's a view, create dummy table for view\n");
/* save "show create" statement for later */
if ((row= mysql_fetch_row(result)) && (scv_buff=row[1]))
@@ -1667,7 +1691,7 @@
*/
my_snprintf(query_buff, sizeof(query_buff),
"SHOW FIELDS FROM %s", result_table);
- if (mysql_query_with_error_report(sock, 0, query_buff))
+ if (mysql_query_with_error_report(mysql, 0, query_buff))
{
/*
View references invalid or privileged table/col/fun (err 1356),
@@ -1675,7 +1699,7 @@
a comment with the view's 'show create' statement. (Bug #17371)
*/
- if (mysql_errno(sock) == ER_VIEW_INVALID)
+ if (mysql_errno(mysql) == ER_VIEW_INVALID)
fprintf(sql_file, "\n-- failed on view %s: %s\n\n", result_table, scv_buff ? scv_buff : "");
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
@@ -1686,7 +1710,7 @@
else
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
- if ((result= mysql_store_result(sock)))
+ if ((result= mysql_store_result(mysql)))
{
if (mysql_num_rows(result))
{
@@ -1739,7 +1763,7 @@
}
my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
result_table);
- if (mysql_query_with_error_report(sock, &result, query_buff))
+ if (mysql_query_with_error_report(mysql, &result, query_buff))
{
if (path)
my_fclose(sql_file, MYF(MY_WME));
@@ -1792,21 +1816,19 @@
}
else
{
- if (verbose)
- fprintf(stderr,
- "%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
- my_progname, mysql_error(sock));
+ verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
+ my_progname, mysql_error(mysql));
my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
result_table);
- if (mysql_query_with_error_report(sock, &result, query_buff))
+ if (mysql_query_with_error_report(mysql, &result, query_buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
/* Make an sql-file, if path was given iow. option -T was given */
- if (!tFlag)
+ if (!opt_no_create_info)
{
if (path)
{
@@ -1853,7 +1875,7 @@
ulong *lengths= mysql_fetch_lengths(result);
if (init)
{
- if (!opt_xml && !tFlag)
+ if (!opt_xml && !opt_no_create_info)
{
fputs(",\n",sql_file);
check_io(sql_file);
@@ -1865,7 +1887,7 @@
if (opt_complete_insert)
dynstr_append(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
- if (!tFlag)
+ if (!opt_no_create_info)
{
if (opt_xml)
{
@@ -1895,22 +1917,22 @@
}
num_fields= mysql_num_rows(result);
mysql_free_result(result);
- if (!tFlag)
+ if (!opt_no_create_info)
{
/* Make an sql-file, if path was given iow. option -T was given */
char buff[20+FN_REFLEN];
uint keynr,primary_key;
my_snprintf(buff, sizeof(buff), "show keys from %s", result_table);
- if (mysql_query_with_error_report(sock, &result, buff))
+ if (mysql_query_with_error_report(mysql, &result, buff))
{
- if (mysql_errno(sock) == ER_WRONG_OBJECT)
+ if (mysql_errno(mysql) == ER_WRONG_OBJECT)
{
/* it is VIEW */
fputs("\t\t<options Comment=\"view\" />\n", sql_file);
goto continue_xml;
}
fprintf(stderr, "%s: Can't get keys for table %s (%s)\n",
- my_progname, result_table, mysql_error(sock));
+ my_progname, result_table, mysql_error(mysql));
if (path)
my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
@@ -1983,21 +2005,19 @@
my_snprintf(buff, sizeof(buff), "show table status like %s",
quote_for_like(table, show_name_buff));
- if (mysql_query_with_error_report(sock, &result, buff))
+ if (mysql_query_with_error_report(mysql, &result, buff))
{
- if (mysql_errno(sock) != ER_PARSE_ERROR)
+ if (mysql_errno(mysql) != ER_PARSE_ERROR)
{ /* If old MySQL version */
- if (verbose)
- fprintf(stderr,
- "-- Warning: Couldn't get status information for table %s (%s)\n",
- result_table,mysql_error(sock));
+ verbose_msg("-- Warning: Couldn't get status information for " \
+ "table %s (%s)\n", result_table,mysql_error(mysql));
}
}
else if (!(row= mysql_fetch_row(result)))
{
fprintf(stderr,
"Error: Couldn't read status information for table %s (%s)\n",
- result_table,mysql_error(sock));
+ result_table,mysql_error(mysql));
}
else
{
@@ -2070,7 +2090,7 @@
"SHOW TRIGGERS LIKE %s",
quote_for_like(table, name_buff));
- if (mysql_query_with_error_report(sock, &result, query_buff))
+ if (mysql_query_with_error_report(mysql, &result, query_buff))
{
if (path)
my_fclose(sql_file, MYF(MY_WME));
@@ -2240,12 +2260,10 @@
return;
/* Check --no-data flag */
- if (dFlag)
+ if (opt_no_data)
{
- if (verbose)
- fprintf(stderr,
- "-- Skipping dump data for table '%s', --no-data was used\n",
- table);
+ verbose_msg("-- Skipping dump data for table '%s', --no-data was used\n",
+ table);
DBUG_VOID_RETURN;
}
@@ -2258,27 +2276,22 @@
*/
if (ignore_flag & IGNORE_DATA)
{
- if (verbose)
- fprintf(stderr,
- "-- Warning: Skipping data for table '%s' because it's of type %s\n",
- table, table_type);
+ verbose_msg("-- Warning: Skipping data for table '%s' because " \
+ "it's of type %s\n", table, table_type);
DBUG_VOID_RETURN;
}
/* Check that there are any fields in the table */
if (num_fields == 0)
{
- if (verbose)
- fprintf(stderr,
- "-- Skipping dump data for table '%s', it has no fields\n",
- table);
+ verbose_msg("-- Skipping dump data for table '%s', it has no fields\n",
+ table);
DBUG_VOID_RETURN;
}
result_table= quote_name(table,table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0);
- if (verbose)
- fprintf(stderr, "-- Sending SELECT query...\n");
+ verbose_msg("-- Sending SELECT query...\n");
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
@@ -2316,9 +2329,9 @@
if (order_by)
end = strxmov(end, " ORDER BY ", order_by, NullS);
}
- if (mysql_real_query(sock, query, (uint) (end - query)))
+ if (mysql_real_query(mysql, query, (uint) (end - query)))
{
- DB_error(sock, "when executing 'SELECT INTO OUTFILE'");
+ DB_error(mysql, "when executing 'SELECT INTO OUTFILE'");
DBUG_VOID_RETURN;
}
}
@@ -2364,19 +2377,19 @@
fputs("\n", md_result_file);
check_io(md_result_file);
}
- if (mysql_query_with_error_report(sock, 0, query))
- DB_error(sock, "when retrieving data from server");
+ if (mysql_query_with_error_report(mysql, 0, query))
+ DB_error(mysql, "when retrieving data from server");
if (quick)
- res=mysql_use_result(sock);
+ res=mysql_use_result(mysql);
else
- res=mysql_store_result(sock);
+ res=mysql_store_result(mysql);
if (!res)
{
- DB_error(sock, "when retrieving data from server");
+ DB_error(mysql, "when retrieving data from server");
goto err;
}
- if (verbose)
- fprintf(stderr, "-- Retrieving rows...\n");
+
+ verbose_msg("-- Retrieving rows...\n");
if (mysql_num_fields(res) != num_fields)
{
fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n",
@@ -2645,13 +2658,13 @@
fputs(";\n", md_result_file); /* If not empty table */
fflush(md_result_file);
check_io(md_result_file);
- if (mysql_errno(sock))
+ if (mysql_errno(mysql))
{
my_snprintf(query, QUERY_LENGTH,
"%s: Error %d: %s when dumping table %s at row: %ld\n",
my_progname,
- mysql_errno(sock),
- mysql_error(sock),
+ mysql_errno(mysql),
+ mysql_error(mysql),
result_table,
rownr);
fputs(query,stderr);
@@ -2697,7 +2710,7 @@
if (!res)
{
- if (!(res = mysql_list_tables(sock,NullS)))
+ if (!(res = mysql_list_tables(mysql,NullS)))
return(NULL);
}
if ((row = mysql_fetch_row(res)))
@@ -2844,7 +2857,7 @@
MYSQL_RES *tableres;
int result=0;
- if (mysql_query_with_error_report(sock, &tableres, "SHOW DATABASES"))
+ if (mysql_query_with_error_report(mysql, &tableres, "SHOW DATABASES"))
return 1;
while ((row = mysql_fetch_row(tableres)))
{
@@ -2853,11 +2866,11 @@
}
if (seen_views)
{
- if (mysql_query(sock, "SHOW DATABASES") ||
- !(tableres = mysql_store_result(sock)))
+ if (mysql_query(mysql, "SHOW DATABASES") ||
+ !(tableres = mysql_store_result(mysql)))
{
my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s",
- MYF(0), mysql_error(sock));
+ MYF(0), mysql_error(mysql));
return 1;
}
while ((row = mysql_fetch_row(tableres)))
@@ -2894,13 +2907,13 @@
static int init_dumping(char *database)
{
- if (mysql_get_server_version(sock) >= 50003 &&
+ if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
- if (mysql_select_db(sock, database))
+ if (mysql_select_db(mysql, database))
{
- DB_error(sock, "when selecting the database");
+ DB_error(mysql, "when selecting the database");
return 1; /* If --force */
}
if (!path && !opt_xml)
@@ -2927,7 +2940,7 @@
"SHOW CREATE DATABASE IF NOT EXISTS %s",
qdatabase);
- if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
+ if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql)))
{
/* Old server version, dump generic CREATE DATABASE */
if (opt_drop_database)
@@ -2997,15 +3010,15 @@
dynstr_append(&query, quote_name(table, table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,");
}
- if (numrows && mysql_real_query(sock, query.str, query.length-1))
- DB_error(sock, "when using LOCK TABLES");
+ if (numrows && mysql_real_query(mysql, query.str, query.length-1))
+ DB_error(mysql, "when using LOCK TABLES");
/* We shall continue here, if --force was given */
dynstr_free(&query);
}
if (flush_logs)
{
- if (mysql_refresh(sock, REFRESH_LOG))
- DB_error(sock, "when doing refresh");
+ if (mysql_refresh(mysql, REFRESH_LOG))
+ DB_error(mysql, "when doing refresh");
/* We shall continue here, if --force was given */
}
while ((table= getTableName(0)))
@@ -3017,7 +3030,7 @@
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
if (opt_dump_triggers && ! opt_xml &&
- mysql_get_server_version(sock) >= 50009)
+ mysql_get_server_version(mysql) >= 50009)
dump_triggers_for_table(table, database);
}
}
@@ -3028,7 +3041,7 @@
dump_events_for_db(database);
}
if (opt_routines && !opt_xml &&
- mysql_get_server_version(sock) >= 50009)
+ mysql_get_server_version(mysql) >= 50009)
{
DBUG_PRINT("info", ("Dumping routines for database %s", database));
dump_routines_for_db(database);
@@ -3039,7 +3052,7 @@
check_io(md_result_file);
}
if (lock_tables)
- VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
+ VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
return 0;
} /* dump_all_tables_in_db */
@@ -3062,9 +3075,9 @@
uint numrows;
char table_buff[NAME_LEN*2+3];
- if (mysql_select_db(sock, database))
+ if (mysql_select_db(mysql, database))
{
- DB_error(sock, "when selecting the database");
+ DB_error(mysql, "when selecting the database");
return 1;
}
if (opt_databases || opt_alldbs)
@@ -3090,15 +3103,15 @@
dynstr_append(&query, quote_name(table, table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,");
}
- if (numrows && mysql_real_query(sock, query.str, query.length-1))
- DB_error(sock, "when using LOCK TABLES");
+ if (numrows && mysql_real_query(mysql, query.str, query.length-1))
+ DB_error(mysql, "when using LOCK TABLES");
/* We shall continue here, if --force was given */
dynstr_free(&query);
}
if (flush_logs)
{
- if (mysql_refresh(sock, REFRESH_LOG))
- DB_error(sock, "when doing refresh");
+ if (mysql_refresh(mysql, REFRESH_LOG))
+ DB_error(mysql, "when doing refresh");
/* We shall continue here, if --force was given */
}
while ((table= getTableName(0)))
@@ -3109,7 +3122,7 @@
check_io(md_result_file);
}
if (lock_tables)
- VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
+ VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
return 0;
} /* dump_all_tables_in_db */
@@ -3139,12 +3152,12 @@
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))
+ if (mysql_query_with_error_report(mysql, 0, query))
{
safe_exit(EX_MYSQLERR);
}
- if ((table_res= mysql_store_result(sock)))
+ if ((table_res= mysql_store_result(mysql)))
{
my_ulonglong num_rows= mysql_num_rows(table_res);
if (num_rows > 0)
@@ -3206,16 +3219,16 @@
if (lock_tables)
{
- if (mysql_real_query(sock, lock_tables_query.str,
+ if (mysql_real_query(mysql, lock_tables_query.str,
lock_tables_query.length-1))
- DB_error(sock, "when doing LOCK TABLES");
+ DB_error(mysql, "when doing LOCK TABLES");
/* We shall countinue here, if --force was given */
}
dynstr_free(&lock_tables_query);
if (flush_logs)
{
- if (mysql_refresh(sock, REFRESH_LOG))
- DB_error(sock, "when doing refresh");
+ if (mysql_refresh(mysql, REFRESH_LOG))
+ DB_error(mysql, "when doing refresh");
/* We shall countinue here, if --force was given */
}
if (opt_xml)
@@ -3227,7 +3240,7 @@
DBUG_PRINT("info",("Dumping table %s", *pos));
dump_table(*pos, db);
if (opt_dump_triggers &&
- mysql_get_server_version(sock) >= 50009)
+ mysql_get_server_version(mysql) >= 50009)
dump_triggers_for_table(*pos, db);
}
@@ -3245,7 +3258,7 @@
}
/* obtain dump of routines (procs/functions) */
if (opt_routines && !opt_xml &&
- mysql_get_server_version(sock) >= 50009)
+ mysql_get_server_version(mysql) >= 50009)
{
DBUG_PRINT("info", ("Dumping routines for database %s", db));
dump_routines_for_db(db);
@@ -3259,7 +3272,7 @@
check_io(md_result_file);
}
if (lock_tables)
- VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
+ VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
DBUG_RETURN(0);
} /* dump_selected_tables */
@@ -3272,8 +3285,6 @@
(opt_master_data == MYSQL_OPT_MASTER_DATA_COMMENTED_SQL) ? "-- " : "";
if (mysql_query_with_error_report(mysql_con, &master, "SHOW MASTER STATUS"))
{
- my_printf_error(0, "Error: Couldn't execute 'SHOW MASTER STATUS': %s",
- MYF(0), mysql_error(mysql_con));
return 1;
}
else
@@ -3444,7 +3455,7 @@
table_type Type of table
GLOBAL VARIABLES
- sock MySQL socket
+ mysql MySQL connection
verbose Write warning messages
RETURN
@@ -3463,14 +3474,12 @@
DBUG_ASSERT(2*sizeof(table_name) < sizeof(show_name_buff));
my_snprintf(buff, sizeof(buff), "show table status like %s",
quote_for_like(table_name, show_name_buff));
- if (mysql_query_with_error_report(sock, &res, buff))
+ if (mysql_query_with_error_report(mysql, &res, buff))
{
- if (mysql_errno(sock) != ER_PARSE_ERROR)
+ if (mysql_errno(mysql) != ER_PARSE_ERROR)
{ /* If old MySQL version */
- if (verbose)
- fprintf(stderr,
- "-- Warning: Couldn't get status information for table %s (%s)\n",
- table_name,mysql_error(sock));
+ verbose_msg("-- Warning: Couldn't get status information for " \
+ "table %s (%s)\n", table_name,mysql_error(mysql));
DBUG_RETURN(result); /* assume table is ok */
}
}
@@ -3478,7 +3487,7 @@
{
fprintf(stderr,
"Error: Couldn't read status information for table %s (%s)\n",
- table_name, mysql_error(sock));
+ table_name, mysql_error(mysql));
mysql_free_result(res);
DBUG_RETURN(result); /* assume table is ok */
}
@@ -3506,7 +3515,7 @@
/*
If these two types, we do want to skip dumping the table
*/
- if (!dFlag &&
+ if (!opt_no_data &&
(!strcmp(table_type,"MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM")))
result= IGNORE_DATA;
}
@@ -3514,6 +3523,7 @@
DBUG_RETURN(result);
}
+
/*
Get string of comma-separated primary key field names
@@ -3543,12 +3553,12 @@
my_snprintf(show_keys_buff, sizeof(show_keys_buff),
"SHOW KEYS FROM %s", table_name);
- if (mysql_query(sock, show_keys_buff) ||
- !(res = mysql_store_result(sock)))
+ if (mysql_query(mysql, show_keys_buff) ||
+ !(res = mysql_store_result(mysql)))
{
fprintf(stderr, "Warning: Couldn't read keys from table %s;"
" records are NOT sorted (%s)\n",
- table_name, mysql_error(sock));
+ table_name, mysql_error(mysql));
/* Don't exit, because it's better to print out unsorted records */
goto cleanup;
}
@@ -3653,11 +3663,10 @@
FILE *sql_file = md_result_file;
DBUG_ENTER("get_view_structure");
- if (tFlag) /* Don't write table creation info */
+ if (opt_no_create_info) /* Don't write table creation info */
DBUG_RETURN(0);
- if (verbose)
- fprintf(stderr, "-- Retrieving view structure for table %s...\n", table);
+ verbose_msg("-- Retrieving view structure for table %s...\n", table);
#ifdef NOT_REALLY_USED_YET
sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
@@ -3668,7 +3677,7 @@
opt_quoted_table= quote_name(table, table_buff2, 0);
my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table);
- if (mysql_query_with_error_report(sock, &table_res, query))
+ if (mysql_query_with_error_report(mysql, &table_res, query))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
@@ -3678,8 +3687,7 @@
field= mysql_fetch_field_direct(table_res, 0);
if (strcmp(field->name, "View") != 0)
{
- if (verbose)
- fprintf(stderr, "-- It's base table, skipped\n");
+ verbose_msg("-- It's base table, skipped\n");
DBUG_RETURN(0);
}
@@ -3714,7 +3722,7 @@
"SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE " \
"FROM information_schema.views " \
"WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db);
- if (mysql_query(sock, query))
+ if (mysql_query(mysql, query))
{
/*
Use the raw output from SHOW CREATE TABLE if
@@ -3740,7 +3748,7 @@
mysql_free_result(table_res);
/* Get the result from "select ... information_schema" */
- if (!(table_res= mysql_store_result(sock)) ||
+ if (!(table_res= mysql_store_result(mysql)) ||
!(row= mysql_fetch_row(table_res)))
{
safe_exit(EX_MYSQLERR);
@@ -3835,21 +3843,21 @@
write_header(md_result_file, *argv);
if ((opt_lock_all_tables || opt_master_data) &&
- do_flush_tables_read_lock(sock))
+ do_flush_tables_read_lock(mysql))
goto err;
- if (opt_single_transaction && start_transaction(sock, test(opt_master_data)))
+ if (opt_single_transaction && start_transaction(mysql, test(opt_master_data)))
goto err;
- if (opt_delete_master_logs && do_reset_master(sock))
+ if (opt_delete_master_logs && do_reset_master(mysql))
goto err;
if (opt_lock_all_tables || opt_master_data)
{
- if (flush_logs && mysql_refresh(sock, REFRESH_LOG))
+ if (flush_logs && mysql_refresh(mysql, REFRESH_LOG))
goto err;
flush_logs= 0; /* not anymore; that would not be sensible */
}
- if (opt_master_data && do_show_master_status(sock))
+ if (opt_master_data && do_show_master_status(mysql))
goto err;
- if (opt_single_transaction && do_unlock_tables(sock)) /* unlock but no commit! */
+ if (opt_single_transaction && do_unlock_tables(mysql)) /* unlock but no commit! */
goto err;
if (opt_alltspcs)
--- 1.28/dbug/dbug.c 2006-08-15 16:24:52 +08:00
+++ 1.29/dbug/dbug.c 2006-08-15 16:24:52 +08:00
@@ -71,10 +71,13 @@
*
*/
+#include <my_global.h>
+
+/* This file won't compile unless DBUG_OFF is undefined locally */
#ifdef DBUG_OFF
#undef DBUG_OFF
#endif
-#include <my_global.h>
+
#include <m_string.h>
#include <errno.h>
#if defined(MSDOS) || defined(__WIN__)
--- 1.46/extra/perror.c 2006-08-15 16:24:52 +08:00
+++ 1.47/extra/perror.c 2006-08-15 16:24:52 +08:00
@@ -218,8 +218,11 @@
On some system, like NETWARE, strerror(unknown_error) returns a
string 'Unknown Error'. To avoid printing it we try to find the
error string by asking for an impossible big error message.
+
+ On Solaris 2.8 it might return NULL
*/
- msg= strerror(10000);
+ if ((msg= strerror(10000)) == NULL)
+ msg= "Unknown Error";
/*
Allocate a buffer for unknown_error since strerror always returns
@@ -258,7 +261,7 @@
found= 1;
msg= 0;
}
- else
+ else
#endif
msg = strerror(code);
@@ -278,20 +281,23 @@
else
puts(msg);
}
- if (!(msg=get_ha_error_msg(code)))
+
+ if (!found)
{
- if (!found)
- {
+ /* Error message still not found, look in handler error codes */
+ if (!(msg=get_ha_error_msg(code)))
+ {
fprintf(stderr,"Illegal error code: %d\n",code);
error=1;
- }
- }
- else
- {
- if (verbose)
- printf("MySQL error code %3d: %s\n",code,msg);
- else
- puts(msg);
+ }
+ else
+ {
+ found= 1;
+ if (verbose)
+ printf("MySQL error code %3d: %s\n",code,msg);
+ else
+ puts(msg);
+ }
}
}
}
--- 1.163/include/mysql.h 2006-08-15 16:24:52 +08:00
+++ 1.164/include/mysql.h 2006-08-15 16:24:52 +08:00
@@ -848,7 +848,6 @@
#define stmt_command(mysql, command, arg, length, stmt) \
(*(mysql)->methods->advanced_command)(mysql, command, NullS, \
0, arg, length, 1, stmt)
-unsigned long net_safe_read(MYSQL* mysql);
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
--- 1.108/include/mysql_com.h 2006-08-15 16:24:52 +08:00
+++ 1.109/include/mysql_com.h 2006-08-15 16:24:52 +08:00
@@ -144,7 +144,6 @@
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
-#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
#define SERVER_QUERY_NO_INDEX_USED 32
--- 1.257/libmysql/libmysql.c 2006-08-15 16:24:52 +08:00
+++ 1.258/libmysql/libmysql.c 2006-08-15 16:24:52 +08:00
@@ -639,7 +639,7 @@
NET *net= &mysql->net;
ulong pkt_length;
- pkt_length= net_safe_read(mysql);
+ pkt_length= cli_safe_read(mysql);
if (pkt_length == packet_error)
return 1;
@@ -660,7 +660,7 @@
return 1;
}
/* Read what server thinks about out new auth message report */
- if (net_safe_read(mysql) == packet_error)
+ if (cli_safe_read(mysql) == packet_error)
return 1;
}
return 0;
@@ -1881,7 +1881,7 @@
DBUG_ENTER("cli_read_prepare_result");
mysql= mysql->last_used_con;
- if ((packet_length= net_safe_read(mysql)) == packet_error)
+ if ((packet_length= cli_safe_read(mysql)) == packet_error)
DBUG_RETURN(1);
mysql->warning_count= 0;
@@ -2499,7 +2499,8 @@
if (stmt->param_count)
{
- NET *net= &stmt->mysql->net;
+ MYSQL *mysql= stmt->mysql;
+ NET *net= &mysql->net;
MYSQL_BIND *param, *param_end;
char *param_data;
ulong length;
@@ -2511,7 +2512,8 @@
set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate);
DBUG_RETURN(1);
}
- if (stmt->mysql->status != MYSQL_STATUS_READY)
+ if (mysql->status != MYSQL_STATUS_READY ||
+ mysql->server_status & SERVER_MORE_RESULTS_EXISTS)
{
set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
DBUG_RETURN(1);
@@ -4526,7 +4528,7 @@
int cli_unbuffered_fetch(MYSQL *mysql, char **row)
{
- if (packet_error == net_safe_read(mysql))
+ if (packet_error == cli_safe_read(mysql))
return 1;
*row= ((mysql->net.read_pos[0] == 254) ? NULL :
@@ -4635,7 +4637,7 @@
mysql= mysql->last_used_con;
- while ((pkt_len= net_safe_read(mysql)) != packet_error)
+ while ((pkt_len= cli_safe_read(mysql)) != packet_error)
{
cp= net->read_pos;
if (cp[0] != 254 || pkt_len >= 8)
--- 1.332/sql/field.cc 2006-08-15 16:24:52 +08:00
+++ 1.333/sql/field.cc 2006-08-15 16:24:52 +08:00
@@ -8523,7 +8523,8 @@
comment= *fld_comment;
/*
- Set flag if this field doesn't have a default value
+ Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
+ it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
*/
if (!fld_default_value && !(fld_type_modifier & AUTO_INCREMENT_FLAG) &&
(fld_type_modifier & NOT_NULL_FLAG) && fld_type != FIELD_TYPE_TIMESTAMP)
@@ -8600,11 +8601,27 @@
/* Allow empty as default value. */
String str,*res;
res= fld_default_value->val_str(&str);
- if (res->length())
+ /*
+ A default other than '' is always an error, and any non-NULL
+ specified default is an error in strict mode.
+ */
+ if (res->length() || (thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES |
+ MODE_STRICT_ALL_TABLES)))
{
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0),
fld_name); /* purecov: inspected */
DBUG_RETURN(TRUE);
+ }
+ else
+ {
+ /*
+ Otherwise a default of '' is just a warning.
+ */
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_BLOB_CANT_HAVE_DEFAULT,
+ ER(ER_BLOB_CANT_HAVE_DEFAULT),
+ fld_name);
}
def= 0;
}
--- 1.203/sql/item.cc 2006-08-15 16:24:52 +08:00
+++ 1.204/sql/item.cc 2006-08-15 16:24:52 +08:00
@@ -1456,7 +1456,8 @@
In case we're in statement prepare, create conversion item
in its memory: it will be reused on each execute.
*/
- arena= thd->activate_stmt_arena_if_needed(&backup);
+ arena= thd->is_stmt_prepare() ? thd->activate_stmt_arena_if_needed(&backup)
+ : NULL;
for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
{
@@ -1491,7 +1492,7 @@
been created in prepare. In this case register the change for
rollback.
*/
- if (arena && arena->is_conventional())
+ if (arena)
*arg= conv;
else
thd->change_item_tree(arg, conv);
@@ -6148,14 +6149,13 @@
max_length= my_decimal_precision_to_length(precision, decimals,
unsigned_flag);
}
- else
- max_length= max(max_length, display_length(item));
-
+
switch (Field::result_merge_type(fld_type))
{
case STRING_RESULT:
{
const char *old_cs, *old_derivation;
+ uint32 old_max_chars= max_length / collation.collation->mbmaxlen;
old_cs= collation.collation->name;
old_derivation= collation.derivation_name();
if (collation.aggregate(item->collation, MY_COLL_ALLOW_CONV))
@@ -6167,6 +6167,14 @@
"UNION");
DBUG_RETURN(TRUE);
}
+ /*
+ To figure out max_length, we have to take into account possible
+ expansion of the size of the values because of character set
+ conversions.
+ */
+ max_length= max(old_max_chars * collation.collation->mbmaxlen,
+ display_length(item) / item->collation.collation->mbmaxlen *
+ collation.collation->mbmaxlen);
break;
}
case REAL_RESULT:
@@ -6185,7 +6193,8 @@
max_length= (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7;
break;
}
- default:;
+ default:
+ max_length= max(max_length, display_length(item));
};
maybe_null|= item->maybe_null;
get_full_info(item);
--- 1.306/sql/item_func.cc 2006-08-15 16:24:52 +08:00
+++ 1.307/sql/item_func.cc 2006-08-15 16:24:52 +08:00
@@ -3412,6 +3412,7 @@
entry->length=0;
entry->update_query_id=0;
entry->collation.set(NULL, DERIVATION_IMPLICIT);
+ entry->unsigned_flag= 0;
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
@@ -3498,6 +3499,7 @@
type - type of new value
cs - charset info for new value
dv - derivation for new value
+ unsigned_arg - indiates if a value of type INT_RESULT is unsigned
RETURN VALUE
False - success, True - failure
@@ -3505,7 +3507,8 @@
static bool
update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
- Item_result type, CHARSET_INFO *cs, Derivation dv)
+ Item_result type, CHARSET_INFO *cs, Derivation dv,
+ bool unsigned_arg)
{
if (set_null)
{
@@ -3553,6 +3556,7 @@
((my_decimal*)entry->value)->fix_buffer_pointer();
entry->length= length;
entry->collation.set(cs, dv);
+ entry->unsigned_flag= unsigned_arg;
}
entry->type=type;
return 0;
@@ -3561,7 +3565,8 @@
bool
Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
- CHARSET_INFO *cs, Derivation dv)
+ CHARSET_INFO *cs, Derivation dv,
+ bool unsigned_arg)
{
/*
If we set a variable explicitely to NULL then keep the old
@@ -3570,7 +3575,7 @@
if ((null_value= args[0]->null_value) && null_item)
type= entry->type; // Don't change type of item
if (::update_hash(entry, (null_value= args[0]->null_value),
- ptr, length, type, cs, dv))
+ ptr, length, type, cs, dv, unsigned_arg))
{
current_thd->fatal_error(); // Probably end of memory
null_value= 1;
@@ -3652,7 +3657,10 @@
str->set_real(*(double*) value, decimals, &my_charset_bin);
break;
case INT_RESULT:
- str->set(*(longlong*) value, &my_charset_bin);
+ if (!unsigned_flag)
+ str->set(*(longlong*) value, &my_charset_bin);
+ else
+ str->set(*(ulonglong*) value, &my_charset_bin);
break;
case DECIMAL_RESULT:
my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
@@ -3723,6 +3731,7 @@
case INT_RESULT:
{
save_result.vint= args[0]->val_int();
+ unsigned_flag= args[0]->unsigned_flag;
break;
}
case STRING_RESULT:
@@ -3778,7 +3787,8 @@
case INT_RESULT:
{
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
- INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
+ INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
+ unsigned_flag);
break;
}
case STRING_RESULT:
@@ -4157,7 +4167,7 @@
void Item_user_var_as_out_param::set_null_value(CHARSET_INFO* cs)
{
if (::update_hash(entry, TRUE, 0, 0, STRING_RESULT, cs,
- DERIVATION_IMPLICIT))
+ DERIVATION_IMPLICIT, 0 /* unsigned_arg */))
current_thd->fatal_error(); // Probably end of memory
}
@@ -4166,7 +4176,7 @@
CHARSET_INFO* cs)
{
if (::update_hash(entry, FALSE, (void*)str, length, STRING_RESULT, cs,
- DERIVATION_IMPLICIT))
+ DERIVATION_IMPLICIT, 0 /* unsigned_arg */))
current_thd->fatal_error(); // Probably end of memory
}
@@ -4837,7 +4847,9 @@
{
bool err_status= TRUE;
Sub_statement_state statement_state;
- Security_context *save_security_ctx= thd->security_ctx, *save_ctx_func;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *save_security_ctx= thd->security_ctx;
+#endif
DBUG_ENTER("Item_func_sp::execute_impl");
@@ -4848,7 +4860,7 @@
thd->security_ctx= context->security_ctx;
}
#endif
- if (find_and_check_access(thd, EXECUTE_ACL, &save_ctx_func))
+ if (find_and_check_access(thd))
goto error;
/*
@@ -4860,13 +4872,11 @@
err_status= m_sp->execute_function(thd, args, arg_count, return_value_fld);
thd->restore_sub_statement_state(&statement_state);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- sp_restore_security_context(thd, save_ctx_func);
error:
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->security_ctx= save_security_ctx;
-#else
-error:
#endif
+
DBUG_RETURN(err_status);
}
@@ -4983,70 +4993,38 @@
SYNOPSIS
find_and_check_access()
thd thread handler
- want_access requested access
- save backup of security context
RETURN
FALSE Access granted
TRUE Requested access can't be granted or function doesn't exists
- In this case security context is not changed and *save = 0
NOTES
Checks if requested access to function can be granted to user.
If function isn't found yet, it searches function first.
If function can't be found or user don't have requested access
error is raised.
- If security context sp_ctx is provided and access can be granted then
- switch back to previous context isn't performed.
- In case of access error or if context is not provided then
- find_and_check_access() switches back to previous security context.
*/
bool
-Item_func_sp::find_and_check_access(THD *thd, ulong want_access,
- Security_context **save)
+Item_func_sp::find_and_check_access(THD *thd)
{
- bool res= TRUE;
-
- *save= 0; // Safety if error
if (! m_sp && ! (m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
&thd->sp_func_cache, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
- goto error;
+ return TRUE;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (check_routine_access(thd, want_access,
+ if (check_routine_access(thd, EXECUTE_ACL,
m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
- goto error;
-
- sp_change_security_context(thd, m_sp, save);
- /*
- If we changed context to run as another user, we need to check the
- access right for the new context again as someone may have deleted
- this person the right to use the procedure
-
- TODO:
- Cache if the definer has the right to use the object on the first
- usage and only reset the cache if someone does a GRANT statement
- that 'may' affect this.
- */
- if (*save &&
- check_routine_access(thd, want_access,
- m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
- {
- sp_restore_security_context(thd, *save);
- *save= 0; // Safety
- goto error;
- }
+ return TRUE;
#endif
- res= FALSE; // no error
-error:
- return res;
+ return FALSE;
}
+
bool
Item_func_sp::fix_fields(THD *thd, Item **ref)
{
@@ -5057,19 +5035,23 @@
{
/*
Here we check privileges of the stored routine only during view
- creation, in order to validate the view. A runtime check is perfomed
- in Item_func_sp::execute(), and this method is not called during
- context analysis. We do not need to restore the security context
- changed in find_and_check_access because all view structures created
- in CREATE VIEW are not used for execution. Notice, that during view
- creation we do not infer into stored routine bodies and do not check
- privileges of its statements, which would probably be a good idea
- especially if the view has SQL SECURITY DEFINER and the used stored
- procedure has SQL SECURITY DEFINER
+ creation, in order to validate the view. A runtime check is
+ perfomed in Item_func_sp::execute(), and this method is not
+ called during context analysis. Notice, that during view
+ creation we do not infer into stored routine bodies and do not
+ check privileges of its statements, which would probably be a
+ good idea especially if the view has SQL SECURITY DEFINER and
+ the used stored procedure has SQL SECURITY DEFINER.
*/
- Security_context *save_ctx;
- if (!(res= find_and_check_access(thd, EXECUTE_ACL, &save_ctx)))
- sp_restore_security_context(thd, save_ctx);
+ res= find_and_check_access(thd);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *save_secutiry_ctx;
+ if (!res && !(res= set_routine_security_ctx(thd, m_sp, false,
+ &save_secutiry_ctx)))
+ {
+ sp_restore_security_context(thd, save_secutiry_ctx);
+ }
+#endif /* ! NO_EMBEDDED_ACCESS_CHECKS */
}
return res;
}
--- 1.143/sql/item_func.h 2006-08-15 16:24:52 +08:00
+++ 1.144/sql/item_func.h 2006-08-15 16:24:52 +08:00
@@ -1190,8 +1190,6 @@
String *vstr;
my_decimal *vdec;
} save_result;
- String save_buff;
-
public:
LEX_STRING name; // keep it public
@@ -1202,8 +1200,8 @@
longlong val_int();
String *val_str(String *str);
my_decimal *val_decimal(my_decimal *);
- bool update_hash(void *ptr, uint length, enum Item_result type,
- CHARSET_INFO *cs, Derivation dv);
+ bool update_hash(void *ptr, uint length, enum Item_result type,
+ CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0);
bool check();
bool update();
enum Item_result result_type () const { return cached_result_type; }
@@ -1502,8 +1500,7 @@
{ context= (Name_resolution_context *)cntx; return FALSE; }
void fix_length_and_dec();
- bool find_and_check_access(THD * thd, ulong want_access,
- Security_context **backup);
+ bool find_and_check_access(THD * thd);
virtual enum Functype functype() const { return FUNC_SP; }
bool fix_fields(THD *thd, Item **ref);
--- 1.284/sql/item_strfunc.cc 2006-08-15 16:24:52 +08:00
+++ 1.285/sql/item_strfunc.cc 2006-08-15 16:24:52 +08:00
@@ -2985,6 +2985,16 @@
if (res->is_empty())
return res;
+ /* If length is less than 4 bytes, data is corrupt */
+ if (res->length() <= 4)
+ {
+ push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_ZLIB_Z_DATA_ERROR,
+ ER(ER_ZLIB_Z_DATA_ERROR));
+ goto err;
+ }
+
+ /* Size of uncompressed data is stored as first 4 bytes of field */
new_size= uint4korr(res->ptr()) & 0x3FFFFFFF;
if (new_size > current_thd->variables.max_allowed_packet)
{
--- 1.115/sql/item_strfunc.h 2006-08-15 16:24:52 +08:00
+++ 1.116/sql/item_strfunc.h 2006-08-15 16:24:52 +08:00
@@ -831,7 +831,7 @@
String buffer;
public:
Item_func_uncompress(Item *a): Item_str_func(a){}
- void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
+ void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
const char *func_name() const{return "uncompress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
bool check_partition_func_processor(byte *bool_arg) { return 0;}
--- 1.103/sql/item_sum.h 2006-08-15 16:24:52 +08:00
+++ 1.104/sql/item_sum.h 2006-08-15 16:24:52 +08:00
@@ -688,7 +688,7 @@
{ return sample ? "var_samp(" : "variance("; }
Item *copy_or_same(THD* thd);
Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
- enum Item_result result_type () const { return hybrid_type; }
+ enum Item_result result_type () const { return REAL_RESULT; }
};
class Item_sum_std;
--- 1.128/sql/item_timefunc.cc 2006-08-15 16:24:53 +08:00
+++ 1.129/sql/item_timefunc.cc 2006-08-15 16:24:53 +08:00
@@ -2756,6 +2756,8 @@
{
uint year_beg, year_end, month_beg, month_end, day_beg, day_end;
uint years= 0;
+ uint second_beg, second_end, microsecond_beg, microsecond_end;
+
if (neg == -1)
{
year_beg= ltime2.year;
@@ -2764,6 +2766,10 @@
month_end= ltime1.month;
day_beg= ltime2.day;
day_end= ltime1.day;
+ second_beg= ltime2.hour * 3600 + ltime2.minute * 60 + ltime2.second;
+ second_end= ltime1.hour * 3600 + ltime1.minute * 60 + ltime1.second;
+ microsecond_beg= ltime2.second_part;
+ microsecond_end= ltime1.second_part;
}
else
{
@@ -2773,6 +2779,10 @@
month_end= ltime2.month;
day_beg= ltime1.day;
day_end= ltime2.day;
+ second_beg= ltime1.hour * 3600 + ltime1.minute * 60 + ltime1.second;
+ second_end= ltime2.hour * 3600 + ltime2.minute * 60 + ltime2.second;
+ microsecond_beg= ltime1.second_part;
+ microsecond_end= ltime2.second_part;
}
/* calc years */
@@ -2786,7 +2796,12 @@
months+= 12 - (month_beg - month_end);
else
months+= (month_end - month_beg);
+
if (day_end < day_beg)
+ months-= 1;
+ else if ((day_end == day_beg) &&
+ ((second_end < second_beg) ||
+ (second_end == second_beg && microsecond_end < microsecond_beg)))
months-= 1;
}
--- 1.131/client/mysqlbinlog.cc 2006-08-15 16:24:53 +08:00
+++ 1.132/client/mysqlbinlog.cc 2006-08-15 16:24:53 +08:00
@@ -36,6 +36,7 @@
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
#include "mysql_priv.h"
#include "log_event.h"
+#include "sql_common.h"
#define BIN_LOG_HEADER_SIZE 4
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
@@ -1104,7 +1105,7 @@
const char *error_msg;
Log_event *ev;
- len = net_safe_read(mysql);
+ len= cli_safe_read(mysql);
if (len == packet_error)
{
fprintf(stderr, "Got error reading packet from server: %s\n",
--- 1.573/sql/mysqld.cc 2006-08-15 16:24:53 +08:00
+++ 1.574/sql/mysqld.cc 2006-08-15 16:24:53 +08:00
@@ -2837,6 +2837,11 @@
mysql_real_data_home);
lower_case_table_names= 0;
}
+ else
+ {
+ lower_case_file_system=
+ (test_if_case_insensitive(mysql_real_data_home) == 1);
+ }
/* Reset table_alias_charset, now that lower_case_table_names is set. */
table_alias_charset= (lower_case_table_names ?
--- 1.116/sql/protocol.cc 2006-08-15 16:24:53 +08:00
+++ 1.117/sql/protocol.cc 2006-08-15 16:24:53 +08:00
@@ -322,7 +322,7 @@
254 Marker (1 byte)
warning_count Stored in 2 bytes; New in 4.1 protocol
status_flag Stored in 2 bytes;
- For flags like SERVER_STATUS_MORE_RESULTS
+ For flags like SERVER_MORE_RESULTS_EXISTS
Note that the warning count will not be sent if 'no_flush' is set as
we don't want to report the warning count until all data is sent to the
--- 1.279/sql/slave.cc 2006-08-15 16:24:53 +08:00
+++ 1.280/sql/slave.cc 2006-08-15 16:24:53 +08:00
@@ -2823,7 +2823,7 @@
DBUG_RETURN(packet_error);
#endif
- len = net_safe_read(mysql);
+ len = cli_safe_read(mysql);
if (len == packet_error || (long) len < 1)
{
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
--- 1.315/sql/sql_class.h 2006-08-15 16:24:53 +08:00
+++ 1.316/sql/sql_class.h 2006-08-15 16:24:53 +08:00
@@ -2018,6 +2018,7 @@
ulong length;
query_id_t update_query_id, used_query_id;
Item_result type;
+ bool unsigned_flag;
double val_real(my_bool *null_value);
longlong val_int(my_bool *null_value);
--- 1.194/sql/sql_lex.cc 2006-08-15 16:24:53 +08:00
+++ 1.195/sql/sql_lex.cc 2006-08-15 16:24:53 +08:00
@@ -127,6 +127,7 @@
lex->param_list.empty();
lex->view_list.empty();
lex->prepared_stmt_params.empty();
+ lex->auxiliary_table_list.empty();
lex->unit.next= lex->unit.master=
lex->unit.link_next= lex->unit.return_to= 0;
lex->unit.prev= lex->unit.link_prev= 0;
@@ -1058,6 +1059,30 @@
return(result_state);
}
}
+}
+
+
+/*
+ Skip comment in the end of statement.
+
+ SYNOPSIS
+ skip_rear_comments()
+ begin pointer to the beginning of statement
+ end pointer to the end of statement
+
+ DESCRIPTION
+ The function is intended to trim comments at the end of the statement.
+
+ RETURN
+ Pointer to the last non-comment symbol of the statement.
+*/
+
+uchar *skip_rear_comments(uchar *begin, uchar *end)
+{
+ while (begin < end && (end[-1] <= ' ' || end[-1] == '*' ||
+ end[-1] == '/' || end[-1] == ';'))
+ end-= 1;
+ return end;
}
/*
--- 1.578/sql/sql_parse.cc 2006-08-15 16:24:53 +08:00
+++ 1.579/sql/sql_parse.cc 2006-08-15 16:24:53 +08:00
@@ -4587,9 +4587,6 @@
}
else
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- Security_context *save_ctx;
-#endif
ha_rows select_limit;
/* bits that should be cleared in thd->server_status */
uint bits_to_be_cleared= 0;
@@ -4631,21 +4628,11 @@
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_routine_access(thd, EXECUTE_ACL,
- sp->m_db.str, sp->m_name.str, TRUE, 0) ||
- sp_change_security_context(thd, sp, &save_ctx))
+ sp->m_db.str, sp->m_name.str, TRUE, FALSE))
{
thd->net.no_send_ok= nsok;
goto error;
}
- if (save_ctx &&
- check_routine_access(thd, EXECUTE_ACL,
- sp->m_db.str, sp->m_name.str, TRUE, 0))
- {
- thd->net.no_send_ok= nsok;
- sp_restore_security_context(thd, save_ctx);
- goto error;
- }
-
#endif
select_limit= thd->variables.select_limit;
thd->variables.select_limit= HA_POS_ERROR;
@@ -4669,9 +4656,6 @@
thd->total_warn_count= 0;
thd->variables.select_limit= select_limit;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- sp_restore_security_context(thd, save_ctx);
-#endif
thd->net.no_send_ok= nsok;
thd->server_status&= ~bits_to_be_cleared;
--- 1.67/sql/sql_udf.cc 2006-08-15 16:24:53 +08:00
+++ 1.68/sql/sql_udf.cc 2006-08-15 16:24:53 +08:00
@@ -210,7 +210,7 @@
}
}
if (error > 0)
- sql_print_error(ER(ER_GET_ERRNO), my_errno);
+ sql_print_error("Got unknown error: %d", my_errno);
end_read_record(&read_record_info);
new_thd->version--; // Force close to free memory
--- 1.238/sql/table.cc 2006-08-15 16:24:53 +08:00
+++ 1.239/sql/table.cc 2006-08-15 16:24:53 +08:00
@@ -4046,13 +4046,27 @@
st_table_list::reinit_before_use()
*/
-void st_table_list::reinit_before_use(THD * /* thd */)
+void st_table_list::reinit_before_use(THD *thd)
{
/*
Reset old pointers to TABLEs: they are not valid since the tables
were closed in the end of previous prepare or execute call.
*/
table= 0;
+ /* Reset is_schema_table_processed value(needed for I_S tables */
+ is_schema_table_processed= FALSE;
+
+ TABLE_LIST *embedded; /* The table at the current level of nesting. */
+ TABLE_LIST *embedding= this; /* The parent nested table reference. */
+ do
+ {
+ embedded= embedding;
+ if (embedded->prep_on_expr)
+ embedded->on_expr= embedded->prep_on_expr->copy_andor_structure(thd);
+ embedding= embedded->embedding;
+ }
+ while (embedding &&
+ embedding->nested_join->join_list.head() == embedded);
}
--- 1.147/sql/table.h 2006-08-15 16:24:53 +08:00
+++ 1.148/sql/table.h 2006-08-15 16:24:53 +08:00
@@ -795,6 +795,10 @@
private:
bool prep_check_option(THD *thd, uint8 check_opt_type);
bool prep_where(THD *thd, Item **conds, bool no_where_clause);
+ /*
+ Cleanup for re-execution in a prepared statement or a stored
+ procedure.
+ */
} TABLE_LIST;
class Item;
--- 1.4/mysql-test/r/im_daemon_life_cycle.result 2006-08-15 16:24:53 +08:00
+++ 1.5/mysql-test/r/im_daemon_life_cycle.result 2006-08-15 16:24:53 +08:00
@@ -1,4 +1,7 @@
Success: the process has been started.
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
SHOW INSTANCES;
instance_name state
mysqld1 online
--- 1.7/mysql-test/r/im_utils.result 2006-08-15 16:24:53 +08:00
+++ 1.8/mysql-test/r/im_utils.result 2006-08-15 16:24:53 +08:00
@@ -1,4 +1,7 @@
Success: the process has been started.
+SHOW VARIABLES LIKE 'server_id';
+Variable_name Value
+server_id 1
SHOW INSTANCES;
instance_name state
mysqld1 online
--- 1.3/mysql-test/t/im_daemon_life_cycle.imtest 2006-08-15 16:24:53 +08:00
+++ 1.4/mysql-test/t/im_daemon_life_cycle.imtest 2006-08-15 16:24:53 +08:00
@@ -7,21 +7,7 @@
###########################################################################
--source include/im_check_os.inc
-
-###########################################################################
-
-# Wait for mysqld1 (guarded instance) to start.
-
---exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
-
-# Let IM detect that mysqld1 is online. This delay should be longer than
-# monitoring interval.
-
---sleep 3
-
-# Check that start conditions are as expected.
-
-SHOW INSTANCES;
+--source include/im_check_env.inc
###########################################################################
--- 1.7/mysql-test/t/im_life_cycle.imtest 2006-08-15 16:24:53 +08:00
+++ 1.8/mysql-test/t/im_life_cycle.imtest 2006-08-15 16:24:53 +08:00
@@ -7,33 +7,7 @@
###########################################################################
--source include/im_check_os.inc
-
-###########################################################################
-#
-# 1.1.1. Check that Instance Manager is able:
-# - to read definitions of two mysqld-instances;
-# - to start the first instance;
-# - to understand 'nonguarded' option and keep the second instance down;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.1.
---echo --------------------------------------------------------------------
-
-# Wait for mysqld1 (guarded instance) to start.
-
---exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
-
-# Let IM detect that mysqld1 is online. This delay should be longer than
-# monitoring interval.
-
---sleep 3
-
-# Check that start conditions are as expected.
-
-SHOW INSTANCES;
+--source include/im_check_env.inc
###########################################################################
#
@@ -54,9 +28,10 @@
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
# SHOW INSTANCES;
--connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
@@ -86,9 +61,10 @@
# FIXME: STOP INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
# SHOW INSTANCES;
###########################################################################
@@ -114,8 +90,8 @@
###########################################################################
#
-# 1.1.5. Check that Instance Manager reports correct errors for 'STOP INSTANCE'
-# command:
+# 1.1.5. Check that Instance Manager reports correct errors for
+# 'STOP INSTANCE' command:
# - if the client tries to start unregistered instance;
# - if the client tries to start already stopped instance;
# - if the client submits invalid arguments;
@@ -146,12 +122,10 @@
--echo -- 1.1.6.
--echo --------------------------------------------------------------------
-SHOW INSTANCES;
-
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30
-# Give some time to IM to detect that mysqld was restarted. It should be longer
-# than monitoring interval.
+# Give some time to IM to detect that mysqld was restarted. It should be
+# longer than monitoring interval.
--sleep 3
@@ -172,16 +146,18 @@
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
# SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
# SHOW INSTANCES;
###########################################################################
--- 1.3/mysql-test/t/im_utils.imtest 2006-08-15 16:24:53 +08:00
+++ 1.4/mysql-test/t/im_utils.imtest 2006-08-15 16:24:53 +08:00
@@ -7,36 +7,17 @@
###########################################################################
--source include/im_check_os.inc
+--source include/im_check_env.inc
###########################################################################
#
-# Check starting conditions. This test case assumes that:
-# - two mysqld-instances are registered;
-# - the first instance is online;
-# - the second instance is offline;
+# Check 'SHOW INSTANCE OPTIONS' command.
#
-
-# Wait for mysqld1 (guarded instance) to start.
-
---exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
-
-# Let IM detect that mysqld1 is online. This delay should be longer than
-# monitoring interval.
-
---sleep 3
-
-# Check that start conditions are as expected.
-
-SHOW INSTANCES;
-
-#
-# Check 'SHOW INSTANCE OPTIONS' command:
-# - check that options of both offline and online instances are accessible;
-# - since configuration of an mysqld-instance contains directories, we should
-# completely ignore the second column (values) in order to make the test
-# case produce the same results on different installations;
-# TODO: ignore values of only directory-specific options.
+# Since configuration of an mysqld-instance contains directories, we should
+# completely ignore the second column (values) in order to make the test
+# case produce the same results on different installations;
+# TODO: ignore values of only directory-specific options.
#
--replace_column 2 VALUE
--- 1.127/sql/item_subselect.cc 2006-08-15 16:24:53 +08:00
+++ 1.128/sql/item_subselect.cc 2006-08-15 16:24:53 +08:00
@@ -1554,6 +1554,7 @@
item->max_length= sel_item->max_length;
res_type= sel_item->result_type();
item->decimals= sel_item->decimals;
+ item->unsigned_flag= sel_item->unsigned_flag;
*maybe_null= sel_item->maybe_null;
if (!(row[i]= Item_cache::get_cache(res_type)))
return STRING_RESULT; // we should return something
--- 1.20/mysql-test/r/rpl_sp.result 2006-08-15 16:24:53 +08:00
+++ 1.21/mysql-test/r/rpl_sp.result 2006-08-15 16:24:53 +08:00
@@ -420,4 +420,48 @@
col
test
DROP PROCEDURE p1;
+
+---> Test for BUG#20438
+
+---> Preparing environment...
+---> connection: master
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+
+---> Synchronizing slave with master...
+
+---> connection: master
+
+---> Creating procedure...
+/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
+/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
+
+---> Checking on master...
+SHOW CREATE PROCEDURE p1;
+Procedure sql_mode Create Procedure
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+
+---> Synchronizing slave with master...
+---> connection: master
+
+---> Checking on slave...
+SHOW CREATE PROCEDURE p1;
+Procedure sql_mode Create Procedure
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+
+---> connection: master
+
+---> Cleaning up...
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
drop table t1;
--- 1.32/mysql-test/r/date_formats.result 2006-08-15 16:24:53 +08:00
+++ 1.33/mysql-test/r/date_formats.result 2006-08-15 16:24:53 +08:00
@@ -452,6 +452,8 @@
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
describe t1;
Field Type Null Key Default Extra
f1 datetime YES NULL
@@ -461,7 +463,7 @@
f5 time YES NULL
select * from t1;
f1 f2 f3 f4 f5
-2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
+2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-00 58:00:00
drop table t1;
create table t1 select "02 10" as a, "%d %H" as b;
select str_to_date(a,b) from t1;
--- 1.8/mysql-test/r/mysqlcheck.result 2006-08-15 16:24:53 +08:00
+++ 1.9/mysql-test/r/mysqlcheck.result 2006-08-15 16:24:53 +08:00
@@ -48,3 +48,10 @@
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+create table t1 (a int);
+create view v1 as select * from t1;
+test.t1 OK
+test.t1 OK
+drop view v1;
+drop table t1;
+End of 5.0 tests
--- 1.4/mysql-test/t/mysqlcheck.test 2006-08-15 16:24:53 +08:00
+++ 1.5/mysql-test/t/mysqlcheck.test 2006-08-15 16:24:53 +08:00
@@ -19,3 +19,17 @@
--replace_result 'Table is already up to date' OK
--exec $MYSQL_CHECK --analyze --optimize --databases test information_schema mysql
--exec $MYSQL_CHECK --analyze --optimize information_schema schemata
+
+#
+# Bug #16502: mysqlcheck tries to check views
+#
+create table t1 (a int);
+create view v1 as select * from t1;
+--replace_result 'Table is already up to date' OK
+--exec $MYSQL_CHECK --analyze --optimize --databases test
+--replace_result 'Table is already up to date' OK
+--exec $MYSQL_CHECK --all-in-1 --analyze --optimize --databases test
+drop view v1;
+drop table t1;
+
+--echo End of 5.0 tests
--- 1.102/sql-common/client.c 2006-08-15 16:24:53 +08:00
+++ 1.103/sql-common/client.c 2006-08-15 16:24:53 +08:00
@@ -579,7 +579,7 @@
*****************************************************************************/
ulong
-net_safe_read(MYSQL *mysql)
+cli_safe_read(MYSQL *mysql)
{
NET *net= &mysql->net;
ulong len=0;
@@ -622,6 +622,16 @@
}
else
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
+ /*
+ Cover a protocol design error: error packet does not
+ contain the server status. Therefore, the client has no way
+ to find out whether there are more result sets of
+ a multiple-result-set statement pending. Luckily, in 5.0 an
+ error always aborts execution of a statement, wherever it is
+ a multi-statement or a stored procedure, so it should be
+ safe to unconditionally turn off the flag here.
+ */
+ mysql->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
DBUG_PRINT("error",("Got error: %d/%s (%s)",
net->last_errno, net->sqlstate, net->last_error));
@@ -648,7 +658,7 @@
NET *net= &mysql->net;
my_bool result= 1;
init_sigpipe_variables
- DBUG_ENTER("cli_advanced_command");
+ DBUG_ENTER("cli_advanced_command");
/* Don't give sigpipe errors if the client doesn't want them */
set_sigpipe(mysql);
@@ -658,7 +668,8 @@
if (mysql_reconnect(mysql))
DBUG_RETURN(1);
}
- if (mysql->status != MYSQL_STATUS_READY)
+ if (mysql->status != MYSQL_STATUS_READY ||
+ mysql->server_status & SERVER_MORE_RESULTS_EXISTS)
{
DBUG_PRINT("error",("state: %d", mysql->status));
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
@@ -697,7 +708,7 @@
}
result=0;
if (!skip_check)
- result= ((mysql->packet_length=net_safe_read(mysql)) == packet_error ?
+ result= ((mysql->packet_length=cli_safe_read(mysql)) == packet_error ?
1 : 0);
end:
reset_sigpipe(mysql);
@@ -749,7 +760,7 @@
for (;;)
{
ulong pkt_len;
- if ((pkt_len=net_safe_read(mysql)) == packet_error)
+ if ((pkt_len=cli_safe_read(mysql)) == packet_error)
break;
if (pkt_len <= 8 && mysql->net.read_pos[0] == 254)
{
@@ -1271,7 +1282,7 @@
NET *net = &mysql->net;
DBUG_ENTER("cli_read_rows");
- if ((pkt_len= net_safe_read(mysql)) == packet_error)
+ if ((pkt_len= cli_safe_read(mysql)) == packet_error)
DBUG_RETURN(0);
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
MYF(MY_WME | MY_ZEROFILL))))
@@ -1336,7 +1347,7 @@
}
}
cur->data[field]=to; /* End of last field */
- if ((pkt_len=net_safe_read(mysql)) == packet_error)
+ if ((pkt_len=cli_safe_read(mysql)) == packet_error)
{
free_rows(result);
DBUG_RETURN(0);
@@ -1368,7 +1379,7 @@
uchar *pos, *prev_pos, *end_pos;
NET *net= &mysql->net;
- if ((pkt_len=net_safe_read(mysql)) == packet_error)
+ if ((pkt_len=cli_safe_read(mysql)) == packet_error)
return -1;
if (pkt_len <= 8 && net->read_pos[0] == 254)
{
@@ -1645,23 +1656,23 @@
static MYSQL_METHODS client_methods=
{
- cli_read_query_result,
- cli_advanced_command,
- cli_read_rows,
- cli_use_result,
- cli_fetch_lengths,
- cli_flush_use_result
+ cli_read_query_result, /* read_query_result */
+ cli_advanced_command, /* advanced_command */
+ cli_read_rows, /* read_rows */
+ cli_use_result, /* use_result */
+ cli_fetch_lengths, /* fetch_lengths */
+ cli_flush_use_result /* flush_use_result */
#ifndef MYSQL_SERVER
- ,cli_list_fields,
- cli_read_prepare_result,
- cli_stmt_execute,
- cli_read_binary_rows,
- cli_unbuffered_fetch,
- NULL,
- cli_read_statistics,
- cli_read_query_result,
- cli_read_change_user_result,
- cli_read_binary_rows
+ ,cli_list_fields, /* list_fields */
+ cli_read_prepare_result, /* read_prepare_result */
+ cli_stmt_execute, /* stmt_execute */
+ cli_read_binary_rows, /* read_binary_rows */
+ cli_unbuffered_fetch, /* unbuffered_fetch */
+ NULL, /* free_embedded_thd */
+ cli_read_statistics, /* read_statistics */
+ cli_read_query_result, /* next_result */
+ cli_read_change_user_result, /* read_change_user_result */
+ cli_read_binary_rows /* read_rows_from_cursor */
#endif
};
@@ -2024,7 +2035,7 @@
Part 1: Connection established, read and parse first packet
*/
- if ((pkt_length=net_safe_read(mysql)) == packet_error)
+ if ((pkt_length=cli_safe_read(mysql)) == packet_error)
goto error;
/* Check if version of protocol matches current one */
@@ -2248,7 +2259,7 @@
OK-packet, or re-request scrambled password.
*/
- if ((pkt_length=net_safe_read(mysql)) == packet_error)
+ if ((pkt_length=cli_safe_read(mysql)) == packet_error)
goto error;
if (pkt_length == 1 && net->read_pos[0] == 254 &&
@@ -2265,7 +2276,7 @@
goto error;
}
/* Read what server thinks about out new auth message report */
- if (net_safe_read(mysql) == packet_error)
+ if (cli_safe_read(mysql) == packet_error)
goto error;
}
@@ -2589,7 +2600,7 @@
*/
mysql = mysql->last_used_con;
- if ((length = net_safe_read(mysql)) == packet_error)
+ if ((length = cli_safe_read(mysql)) == packet_error)
DBUG_RETURN(1);
free_old_query(mysql); /* Free old result */
#ifdef MYSQL_CLIENT /* Avoid warn of unused labels*/
@@ -2624,7 +2635,7 @@
if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */
{
int error=handle_local_infile(mysql,(char*) pos);
- if ((length=net_safe_read(mysql)) == packet_error || error)
+ if ((length= cli_safe_read(mysql)) == packet_error || error)
DBUG_RETURN(1);
goto get_info; /* Get info packet */
}
--- 1.58/client/mysqlcheck.c 2006-08-15 16:24:53 +08:00
+++ 1.59/client/mysqlcheck.c 2006-08-15 16:24:53 +08:00
@@ -475,7 +475,7 @@
LINT_INIT(res);
if (use_db(database))
return 1;
- if (mysql_query(sock, "SHOW TABLES") ||
+ if (mysql_query(sock, "SHOW TABLE STATUS") ||
!((res= mysql_store_result(sock))))
return 1;
@@ -501,8 +501,12 @@
}
for (end = tables + 1; (row = mysql_fetch_row(res)) ;)
{
- end= fix_table_name(end, row[0]);
- *end++= ',';
+ /* Skip tables with an engine of NULL (probably a view). */
+ if (row[1])
+ {
+ end= fix_table_name(end, row[0]);
+ *end++= ',';
+ }
}
*--end = 0;
if (tot_length)
@@ -512,7 +516,11 @@
else
{
while ((row = mysql_fetch_row(res)))
- handle_request_for_tables(row[0], strlen(row[0]));
+ /* Skip tables with an engine of NULL (probably a view). */
+ if (row[1])
+ {
+ handle_request_for_tables(row[0], strlen(row[0]));
+ }
}
mysql_free_result(res);
return 0;
--- 1.20/sql-common/my_time.c 2006-08-15 16:24:53 +08:00
+++ 1.21/sql-common/my_time.c 2006-08-15 16:24:53 +08:00
@@ -69,6 +69,7 @@
Here we assume that year and month is ok !
If month is 0 we allow any date. (This only happens if we allow zero
date parts in str_to_datetime())
+ Disallow dates with zero year and non-zero month and/or day.
RETURN
0 ok
@@ -85,7 +86,8 @@
(!(flags & TIME_INVALID_DATES) &&
ltime->month && ltime->day > days_in_month[ltime->month-1] &&
(ltime->month != 2 || calc_days_in_year(ltime->year) != 366 ||
- ltime->day != 29)))
+ ltime->day != 29)) ||
+ (ltime->year == 0 && (ltime->month != 0 || ltime->day != 0)))
{
*was_cut= 2;
return TRUE;
--- 1.60.13.4/ndb/src/mgmsrv/ConfigInfo.cpp 2006-08-15 16:24:54 +08:00
+++ 1.84/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2006-08-15 16:24:54 +08:00
@@ -762,6 +762,30 @@
STR_VALUE(MAX_INT_RNIL)},
{
+ CFG_DB_DISK_PAGE_BUFFER_MEMORY,
+ "DiskPageBufferMemory",
+ DB_TOKEN,
+ "Number bytes on each "DB_TOKEN_PRINT" node allocated for disk page buffer cache",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT64,
+ "64M",
+ "4M",
+ "1024G" },
+
+ {
+ CFG_DB_SGA,
+ "SharedGlobalMemory",
+ DB_TOKEN,
+ "Total number bytes on each "DB_TOKEN_PRINT" node allocated for any use",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT64,
+ "20M",
+ "0",
+ "65536G" }, // 32k pages * 32-bit i value
+
+ {
CFG_DB_START_PARTIAL_TIMEOUT,
"StartPartialTimeout",
DB_TOKEN,
@@ -870,6 +894,18 @@
STR_VALUE(MAX_INT_RNIL) },
{
+ CFG_DB_INITIAL_OPEN_FILES,
+ "InitialNoOfOpenFiles",
+ DB_TOKEN,
+ "Initial number of files open per "DB_TOKEN_PRINT" node.(One thread is created per file)",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "27",
+ "20",
+ STR_VALUE(MAX_INT_RNIL) },
+
+ {
CFG_DB_TRANSACTION_CHECK_INTERVAL,
"TimeBetweenInactiveTransactionAbortCheck",
DB_TOKEN,
@@ -1215,6 +1251,18 @@
"2K",
STR_VALUE(MAX_INT_RNIL) },
+ {
+ CFG_DB_STRING_MEMORY,
+ "StringMemory",
+ DB_TOKEN,
+ "Default size of string memory (0 -> 5% of max 1-100 -> %of max, >100 -> actual bytes)",
+ ConfigInfo::CI_USED,
+ false,
+ ConfigInfo::CI_INT,
+ "0",
+ "0",
+ STR_VALUE(MAX_INT_RNIL) },
+
/***************************************************************************
* API
***************************************************************************/
--- 1.1.5.1/ndb/src/kernel/error/ndbd_exit_codes.c 2006-08-15 16:24:54 +08:00
+++ 1.12/storage/ndb/src/kernel/error/ndbd_exit_codes.c 2006-08-15 16:24:54 +08:00
@@ -62,6 +62,7 @@
{NDBD_EXIT_NODE_NOT_DEAD, XRE, "Internal node state conflict, "
"most probably resolved by restarting node again"},
{NDBD_EXIT_SR_REDOLOG, XFI, "Error while reading the REDO log"},
+ {NDBD_EXIT_SR_SCHEMAFILE, XFI, "Error while reading the schema file"},
/* Currently unused? */
{2311, XIE, "Conflict when selecting restart type"},
{NDBD_EXIT_NO_MORE_UNDOLOG, XCR,
@@ -83,6 +84,10 @@
/* this error message is complemented by additional info when generated */
{NDBD_EXIT_INVALID_CONFIG, XCE,
"Invalid configuration received from Management Server"},
+
+ {NDBD_EXIT_RESOURCE_ALLOC_ERROR, XCE,
+ "Resource allocation error, please review the configuration"},
+
/* this error message is complemented by additional info when
generated, such as signal, and text
*/
--- 1.49.11.1/ndb/src/mgmclient/CommandInterpreter.cpp 2006-08-15 16:24:54 +08:00
+++ 1.64/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2006-08-15 16:24:54 +08:00
@@ -16,14 +16,7 @@
#include <ndb_global.h>
#include <my_sys.h>
-
-//#define HAVE_GLOBAL_REPLICATION
-
#include <Vector.hpp>
-#ifdef HAVE_GLOBAL_REPLICATION
-#include "../rep/repapi/repapi.h"
-#endif
-
#include <mgmapi.h>
#include <util/BaseString.hpp>
@@ -167,11 +160,6 @@
int m_verbose;
int try_reconnect;
int m_error;
-#ifdef HAVE_GLOBAL_REPLICATION
- NdbRepHandle m_repserver;
- const char *rep_host;
- bool rep_connected;
-#endif
struct NdbThread* m_event_thread;
};
@@ -229,10 +217,6 @@
#include <NdbMem.h>
#include <EventLogger.hpp>
#include <signaldata/SetLogLevelOrd.hpp>
-#include <signaldata/GrepImpl.hpp>
-#ifdef HAVE_GLOBAL_REPLICATION
-
-#endif // HAVE_GLOBAL_REPLICATION
#include "MgmtErrorReporter.hpp"
#include <Parser.hpp>
#include <SocketServer.hpp>
@@ -260,9 +244,6 @@
"---------------------------------------------------------------------------\n"
"HELP Print help text\n"
"HELP SHOW Help for SHOW command\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"HELP REPLICATION Help for global replication\n"
-#endif // HAVE_GLOBAL_REPLICATION
#ifdef VM_TRACE // DEBUG ONLY
"HELP DEBUG Help for debug compiled version\n"
#endif
@@ -286,9 +267,6 @@
"EXIT SINGLE USER MODE Exit single user mode\n"
"<id> STATUS Print status\n"
"<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log\n"
-#ifdef HAVE_GLOBAL_REPLICATION
-"REP CONNECT <host:port> Connect to REP server on host:port\n"
-#endif
"PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server\n"
"CONNECT [<connectstring>] Connect to management server (reconnect if already connected)\n"
"QUIT Quit management client\n"
@@ -306,39 +284,6 @@
#endif
;
-#ifdef HAVE_GLOBAL_REPLICATION
-static const char* helpTextRep =
-"---------------------------------------------------------------------------\n"
-" NDB Cluster -- Management Client -- Help for Global Replication\n"
-"---------------------------------------------------------------------------\n"
-"Commands should be executed on the standby NDB Cluster\n"
-"These features are in an experimental release state.\n"
-"\n"
-"Simple Commands:\n"
-"REP START Start Global Replication\n"
-"REP START REQUESTOR Start Global Replication Requestor\n"
-"REP STATUS Show Global Replication status\n"
-"REP STOP Stop Global Replication\n"
-"REP STOP REQUESTOR Stop Global Replication Requestor\n"
-"\n"
-"Advanced Commands:\n"
-"REP START <protocol> Starts protocol\n"
-"REP STOP <protocol> Stops protocol\n"
-"<protocol> = TRANSFER | APPLY | DELETE\n"
-"\n"
-#ifdef VM_TRACE // DEBUG ONLY
-"Debugging commands:\n"
-"REP DELETE Removes epochs stored in primary and standy systems\n"
-"REP DROP <tableid> Drop a table in SS identified by table id\n"
-"REP SLOWSTOP Stop Replication (Tries to synchonize with primary)\n"
-"REP FASTSTOP Stop Replication (Stops in consistent state)\n"
-"<component> = SUBSCRIPTION\n"
-" METALOG | METASCAN | DATALOG | DATASCAN\n"
-" REQUESTOR | TRANSFER | APPLY | DELETE\n"
-#endif
-;
-#endif // HAVE_GLOBAL_REPLICATION
-
#ifdef VM_TRACE // DEBUG ONLY
static const char* helpTextDebug =
"---------------------------------------------------------------------------\n"
@@ -395,11 +340,6 @@
m_connected= false;
m_event_thread= NULL;
try_reconnect = 0;
-#ifdef HAVE_GLOBAL_REPLICATION
- rep_host = NULL;
- m_repserver = NULL;
- rep_connected = false;
-#endif
}
/*
@@ -717,13 +657,6 @@
executePurge(allAfterFirstToken);
DBUG_RETURN(true);
}
-#ifdef HAVE_GLOBAL_REPLICATION
- else if(strcasecmp(firstToken, "REPLICATION") == 0 ||
- strcasecmp(firstToken, "REP") == 0) {
- executeRep(allAfterFirstToken);
- DBUG_RETURN(true);
- }
-#endif // HAVE_GLOBAL_REPLICATION
else if(strcasecmp(firstToken, "ENTER") == 0 &&
allAfterFirstToken != NULL &&
strncasecmp(allAfterFirstToken, "SINGLE USER MODE ",
@@ -1030,11 +963,6 @@
ndbout << endl;
} else if (strcasecmp(parameters, "SHOW") == 0) {
ndbout << helpTextShow;
-#ifdef HAVE_GLOBAL_REPLICATION
- } else if (strcasecmp(parameters, "REPLICATION") == 0 ||
- strcasecmp(parameters, "REP") == 0) {
- ndbout << helpTextRep;
-#endif // HAVE_GLOBAL_REPLICATION
#ifdef VM_TRACE // DEBUG ONLY
} else if (strcasecmp(parameters, "DEBUG") == 0) {
ndbout << helpTextDebug;
@@ -1263,8 +1191,6 @@
case NDB_MGM_NODE_TYPE_UNKNOWN:
ndbout << "Error: Unknown Node Type" << endl;
return;
- case NDB_MGM_NODE_TYPE_REP:
- abort();
}
}
@@ -2211,226 +2137,5 @@
ndbout << "Invalid arguments: expected <BackupId>" << endl;
return;
}
-
-#ifdef HAVE_GLOBAL_REPLICATION
-/*****************************************************************************
- * Global Replication
- *
- * For information about the different commands, see
- * GrepReq::Request in file signaldata/grepImpl.cpp.
- *
- * Below are commands as of 2003-07-05 (may change!):
- * START = 0, ///< Start Global Replication (all phases)
- * START_METALOG = 1, ///< Start Global Replication (all phases)
- * START_METASCAN = 2, ///< Start Global Replication (all phases)
- * START_DATALOG = 3, ///< Start Global Replication (all phases)
- * START_DATASCAN = 4, ///< Start Global Replication (all phases)
- * START_REQUESTOR = 5, ///< Start Global Replication (all phases)
- * ABORT = 6, ///< Immediate stop (removes subscription)
- * SLOW_STOP = 7, ///< Stop after finishing applying current GCI epoch
- * FAST_STOP = 8, ///< Stop after finishing applying all PS GCI epochs
- * START_TRANSFER = 9, ///< Start SS-PS transfer
- * STOP_TRANSFER = 10, ///< Stop SS-PS transfer
- * START_APPLY = 11, ///< Start applying GCI epochs in SS
- * STOP_APPLY = 12, ///< Stop applying GCI epochs in SS
- * STATUS = 13, ///< Status
- * START_SUBSCR = 14,
- * REMOVE_BUFFERS = 15,
- * DROP_TABLE = 16
-
- *****************************************************************************/
-
-void
-CommandInterpreter::executeRep(char* parameters)
-{
- if (emptyString(parameters)) {
- ndbout << helpTextRep;
- return;
- }
-
- char * line = my_strdup(parameters,MYF(MY_WME));
- My_auto_ptr<char> ap1((char*)line);
- char * firstToken = strtok(line, " ");
-
- struct ndb_rep_reply reply;
- unsigned int repId;
-
-
- if (!strcasecmp(firstToken, "CONNECT")) {
- char * host = strtok(NULL, "\0");
- for (unsigned int i = 0; i < strlen(host); ++i) {
- host[i] = tolower(host[i]);
- }
-
- if(host == NULL)
- {
- ndbout_c("host:port must be specified.");
- return;
- }
-
- if(rep_connected) {
- if(m_repserver != NULL) {
- ndb_rep_disconnect(m_repserver);
- rep_connected = false;
- }
- }
-
- if(m_repserver == NULL)
- m_repserver = ndb_rep_create_handle();
- if(ndb_rep_connect(m_repserver, host) < 0)
- ndbout_c("Failed to connect to %s", host);
- else
- rep_connected=true;
- return;
-
- if(!rep_connected) {
- ndbout_c("Not connected to REP server");
- }
- }
-
- /********
- * START
- ********/
- if (!strcasecmp(firstToken, "START")) {
-
- unsigned int req;
- char *startType = strtok(NULL, "\0");
-
- if (startType == NULL) {
- req = GrepReq::START;
- } else if (!strcasecmp(startType, "SUBSCRIPTION")) {
- req = GrepReq::START_SUBSCR;
- } else if (!strcasecmp(startType, "METALOG")) {
- req = GrepReq::START_METALOG;
- } else if (!strcasecmp(startType, "METASCAN")) {
- req = GrepReq::START_METASCAN;
- } else if (!strcasecmp(startType, "DATALOG")) {
- req = GrepReq::START_DATALOG;
- } else if (!strcasecmp(startType, "DATASCAN")) {
- req = GrepReq::START_DATASCAN;
- } else if (!strcasecmp(startType, "REQUESTOR")) {
- req = GrepReq::START_REQUESTOR;
- } else if (!strcasecmp(startType, "TRANSFER")) {
- req = GrepReq::START_TRANSFER;
- } else if (!strcasecmp(startType, "APPLY")) {
- req = GrepReq::START_APPLY;
- } else if (!strcasecmp(startType, "DELETE")) {
- req = GrepReq::START_DELETE;
- } else {
- ndbout_c("Illegal argument to command 'REPLICATION START'");
- return;
- }
-
- int result = ndb_rep_command(m_repserver, req, &repId, &reply);
-
- if (result != 0) {
- ndbout << "Start of Global Replication failed" << endl;
- } else {
- ndbout << "Start of Global Replication ordered" << endl;
- }
- return;
- }
-
- /********
- * STOP
- ********/
- if (!strcasecmp(firstToken, "STOP")) {
- unsigned int req;
- char *startType = strtok(NULL, " ");
- unsigned int epoch = 0;
-
- if (startType == NULL) {
- /**
- * Stop immediately
- */
- req = GrepReq::STOP;
- } else if (!strcasecmp(startType, "EPOCH")) {
- char *strEpoch = strtok(NULL, "\0");
- if(strEpoch == NULL) {
- ndbout_c("Epoch expected!");
- return;
- }
- req = GrepReq::STOP;
- epoch=atoi(strEpoch);
- } else if (!strcasecmp(startType, "SUBSCRIPTION")) {
- req = GrepReq::STOP_SUBSCR;
- } else if (!strcasecmp(startType, "METALOG")) {
- req = GrepReq::STOP_METALOG;
- } else if (!strcasecmp(startType, "METASCAN")) {
- req = GrepReq::STOP_METASCAN;
- } else if (!strcasecmp(startType, "DATALOG")) {
- req = GrepReq::STOP_DATALOG;
- } else if (!strcasecmp(startType, "DATASCAN")) {
- req = GrepReq::STOP_DATASCAN;
- } else if (!strcasecmp(startType, "REQUESTOR")) {
- req = GrepReq::STOP_REQUESTOR;
- } else if (!strcasecmp(startType, "TRANSFER")) {
- req = GrepReq::STOP_TRANSFER;
- } else if (!strcasecmp(startType, "APPLY")) {
- req = GrepReq::STOP_APPLY;
- } else if (!strcasecmp(startType, "DELETE")) {
- req = GrepReq::STOP_DELETE;
- } else {
- ndbout_c("Illegal argument to command 'REPLICATION STOP'");
- return;
- }
- int result = ndb_rep_command(m_repserver, req, &repId, &reply, epoch);
-
- if (result != 0) {
- ndbout << "Stop command failed" << endl;
- } else {
- ndbout << "Stop ordered" << endl;
- }
- return;
- }
-
- /*********
- * STATUS
- *********/
- if (!strcasecmp(firstToken, "STATUS")) {
- struct rep_state repstate;
- int result =
- ndb_rep_get_status(m_repserver, &repId, &reply, &repstate);
-
- if (result != 0) {
- ndbout << "Status request of Global Replication failed" << endl;
- } else {
- ndbout << "Status request of Global Replication ordered" << endl;
- ndbout << "See printout at one of the DB nodes" << endl;
- ndbout << "(Better status report is under development.)" << endl;
- ndbout << " SubscriptionId " << repstate.subid
- << " SubscriptionKey " << repstate.subkey << endl;
- }
- return;
- }
-
- /*********
- * QUERY (see repapi.h for querable counters)
- *********/
- if (!strcasecmp(firstToken, "QUERY")) {
- char *query = strtok(NULL, "\0");
- int queryCounter=-1;
- if(query != NULL) {
- queryCounter = atoi(query);
- }
- struct rep_state repstate;
- unsigned repId = 0;
- int result = ndb_rep_query(m_repserver, (QueryCounter)queryCounter,
- &repId, &reply, &repstate);
-
- if (result != 0) {
- ndbout << "Query repserver failed" << endl;
- } else {
- ndbout << "Query repserver sucessful" << endl;
- ndbout_c("repstate : QueryCounter %d, f=%d l=%d"
- " nodegroups %d" ,
- repstate.queryCounter,
- repstate.first[0], repstate.last[0],
- repstate.no_of_nodegroups );
- }
- return;
- }
-}
-#endif // HAVE_GLOBAL_REPLICATION
template class Vector<char const*>;
--- 1.20.3.1/ndb/src/mgmclient/main.cpp 2006-08-15 16:24:54 +08:00
+++ 1.25/storage/ndb/src/mgmclient/main.cpp 2006-08-15 16:24:54 +08:00
@@ -19,7 +19,7 @@
// copied from mysql.cc to get readline
extern "C" {
-#if defined( __WIN__) || defined(OS2)
+#if defined( __WIN__)
#include <conio.h>
#elif !defined(__NETWARE__)
#include <readline/readline.h>
--- 1.36.1.9/VC++Files/sql/mysqld.dsp 2006-08-15 16:24:54 +08:00
+++ 1.48/BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56 2006-08-15 16:24:54 +08:00
@@ -460,10 +460,6 @@
# End Source File
# Begin Source File
-SOURCE=.\examples\ha_example.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\ha_blackhole.cpp
# End Source File
# Begin Source File
@@ -1111,10 +1107,6 @@
# Begin Source File
SOURCE=.\my_time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\myisammrg\myrg_rnext_same.c
# End Source File
# Begin Source File
--- 1.49/mysql-test/r/func_group.result 2006-08-15 16:24:54 +08:00
+++ 1.50/mysql-test/r/func_group.result 2006-08-15 16:24:54 +08:00
@@ -287,8 +287,8 @@
2 1 1 1.00000 0.00000 1 1 1 1 1
3 1 1 1.00000 0.00000 1 1 1 1 1
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort
Warnings:
Note 1003 select sql_big_result `test`.`t1`.`a` AS `a`,count(`test`.`t1`.`b`) AS `count(b)`,sum(`test`.`t1`.`b`) AS `sum(b)`,avg(`test`.`t1`.`b`) AS `avg(b)`,std(`test`.`t1`.`b`) AS `std(b)`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)`,bit_and(`test`.`t1`.`b`) AS `bit_and(b)`,bit_or(`test`.`t1`.`b`) AS `bit_or(b)`,bit_xor(`test`.`t1`.`b`) AS `bit_xor(b)` from `test`.`t1` group by `test`.`t1`.`a`
drop table t1;
@@ -653,15 +653,6 @@
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
1 SIMPLE t1 index NULL PRIMARY 3 NULL 15 Using index
drop table t1, t2;
-create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
-insert into t1 values (1, 3);
-select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
-count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ
-1
-select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
-Case When Count(*) < MAX_REQ Then 1 Else 0 End
-1
-drop table t1;
create table t1 (a char(10));
insert into t1 values ('a'),('b'),('c');
select coercibility(max(a)) from t1;
@@ -677,21 +668,21 @@
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(1) character set latin2 default NULL
+ `a` char(1) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 select max(a),min(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `max(a)` char(1) character set latin2 default NULL,
- `min(a)` char(1) character set latin2 default NULL
+ `max(a)` char(1) CHARACTER SET latin2 DEFAULT NULL,
+ `min(a)` char(1) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
create table t2 select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(1) character set latin2 default NULL
+ `concat(a)` varchar(1) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2,t1;
create table t1 (a int);
@@ -780,7 +771,7 @@
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `MAX(b)` datetime default NULL
+ `MAX(b)` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1(f1 datetime);
--- 1.67/mysql-test/r/func_time.result 2006-08-15 16:24:54 +08:00
+++ 1.68/mysql-test/r/func_time.result 2006-08-15 16:24:54 +08:00
@@ -667,6 +667,78 @@
timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4;
a1 a2 a3 a4
28 28 29 29
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27')
+0
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28')
+1
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29')
+1
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27')
+1
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28')
+2
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29')
+2
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27')
+0
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28')
+1
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29')
+1
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27')
+1
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28')
+2
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29')
+2
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27')
+0
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28')
+1
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29')
+1
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27')
+1
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28')
+2
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29')
+2
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27')
+0
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28')
+1
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29')
+1
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27')
+1
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28')
+2
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29')
+2
select date_add(time,INTERVAL 1 SECOND) from t1;
date_add(time,INTERVAL 1 SECOND)
NULL
--- 1.50/mysql-test/r/join_outer.result 2006-08-15 16:24:54 +08:00
+++ 1.51/mysql-test/r/join_outer.result 2006-08-15 16:24:54 +08:00
@@ -598,6 +598,8 @@
name tinytext DEFAULT '' NOT NULL,
UNIQUE id (id)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'name' can't have a default value
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
CREATE TABLE t2 (
id int(11) DEFAULT '0' NOT NULL,
--- 1.54/mysql-test/r/type_blob.result 2006-08-15 16:24:54 +08:00
+++ 1.55/mysql-test/r/type_blob.result 2006-08-15 16:24:54 +08:00
@@ -503,6 +503,8 @@
fish 10
drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
+Warnings:
+Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
insert into t1 (id) values (1);
select
charset(load_file('../../std_data/words.dat')),
@@ -788,3 +790,21 @@
616100000000
620000000000
drop table t1;
+create table t1 (a text default '');
+Warnings:
+Warning 1101 BLOB/TEXT column 'a' can't have a default value
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (default);
+select * from t1;
+a
+NULL
+drop table t1;
+set @@sql_mode='TRADITIONAL';
+create table t1 (a text default '');
+ERROR 42000: BLOB/TEXT column 'a' can't have a default value
+set @@sql_mode='';
+End of 5.0 tests
--- 1.32/mysql-test/r/type_datetime.result 2006-08-15 16:24:54 +08:00
+++ 1.33/mysql-test/r/type_datetime.result 2006-08-15 16:24:54 +08:00
@@ -26,6 +26,8 @@
test.t1 check status OK
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
+Warnings:
+Warning 1264 Out of range value adjusted for column 't' at row 5
insert into t1 values ("2003-003-03");
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1;
@@ -34,7 +36,7 @@
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 00:00:00
-0000-01-01 00:00:00
+0000-00-00 00:00:00
0001-01-01 00:00:00
9999-12-31 00:00:00
2000-10-10 00:00:00
--- 1.42/mysql-test/r/type_ranges.result 2006-08-15 16:24:54 +08:00
+++ 1.43/mysql-test/r/type_ranges.result 2006-08-15 16:24:54 +08:00
@@ -38,6 +38,9 @@
KEY (ulonglong,ulong),
KEY (options,flags)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'mediumblob_col' can't have a default value
+Warning 1101 BLOB/TEXT column 'longblob_col' can't have a default value
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned NULL NO PRI NULL auto_increment #
--- 1.48/mysql-test/t/func_group.test 2006-08-15 16:24:54 +08:00
+++ 1.49/mysql-test/t/func_group.test 2006-08-15 16:24:54 +08:00
@@ -378,13 +378,15 @@
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
drop table t1, t2;
---disable_warnings
-create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
---enable_warnings
-insert into t1 values (1, 3);
-select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
-select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
-drop table t1;
+# Moved to func_group_innodb
+#--disable_warnings
+#create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
+#--enable_warnings
+#insert into t1 values (1, 3);
+#select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
+#select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
+#drop table t1;
+
create table t1 (a char(10));
insert into t1 values ('a'),('b'),('c');
@@ -539,6 +541,11 @@
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
DROP TABLE t1;
+
+#
+# Bug #12882 min/max inconsistent on empty table
+#
+# Test case moved to func_group_innodb
#
# Bug #18206: min/max optimization cannot be applied to partial index
#
--- 1.53/mysql-test/t/func_time.test 2006-08-15 16:24:54 +08:00
+++ 1.54/mysql-test/t/func_time.test 2006-08-15 16:24:54 +08:00
@@ -318,6 +318,37 @@
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4;
+# bug 16226
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29');
+
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29');
+
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29');
+
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29');
+
+# end of bug
+
select date_add(time,INTERVAL 1 SECOND) from t1;
drop table t1;
--- 1.44/mysql-test/r/cast.result 2006-08-15 16:24:54 +08:00
+++ 1.45/mysql-test/r/cast.result 2006-08-15 16:24:54 +08:00
@@ -381,3 +381,14 @@
select cast(NULL as decimal(6)) as t1;
t1
NULL
+set names latin1;
+select hex(cast('a' as char(2) binary));
+hex(cast('a' as char(2) binary))
+61
+select hex(cast('a' as binary(2)));
+hex(cast('a' as binary(2)))
+6100
+select hex(cast('a' as char(2) binary));
+hex(cast('a' as char(2) binary))
+61
+End of 5.0 tests
--- 1.32/mysql-test/t/cast.test 2006-08-15 16:24:54 +08:00
+++ 1.33/mysql-test/t/cast.test 2006-08-15 16:24:54 +08:00
@@ -204,7 +204,19 @@
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
DROP TABLE t1;
-# Bug @10237 (CAST(NULL DECIMAL) crashes server)
+
+#
+# Bug #10237 (CAST(NULL DECIMAL) crashes server)
#
select cast(NULL as decimal(6)) as t1;
+
+#
+# Bug #17903: cast to char results in binary
+#
+set names latin1;
+select hex(cast('a' as char(2) binary));
+select hex(cast('a' as binary(2)));
+select hex(cast('a' as char(2) binary));
+
+--echo End of 5.0 tests
--- 1.32/mysql-test/r/strict.result 2006-08-15 16:24:54 +08:00
+++ 1.33/mysql-test/r/strict.result 2006-08-15 16:24:54 +08:00
@@ -5,7 +5,9 @@
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date);
-INSERT INTO t1 VALUES('2004-01-01'),('0000-10-31'),('2004-02-29');
+INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
+INSERT INTO t1 VALUES('0000-10-31');
+ERROR 22007: Incorrect date value: '0000-10-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31');
ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
@@ -54,7 +56,6 @@
select * from t1;
col1
2004-01-01
-0000-10-31
2004-02-29
2004-01-02
2004-01-03
@@ -121,7 +122,9 @@
drop table t1;
set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime);
-INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('0000-10-31 15:30:00'),('2004-02-29 15:30:00');
+INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
+INSERT INTO t1 VALUES('0000-10-31 15:30:00');
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
@@ -141,7 +144,6 @@
select * from t1;
col1
2004-10-31 15:30:00
-0000-10-31 15:30:00
2004-02-29 15:30:00
drop table t1;
CREATE TABLE t1 (col1 timestamp);
@@ -204,6 +206,7 @@
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
+ERROR 22007: Incorrect date value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -219,6 +222,7 @@
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -255,6 +259,7 @@
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
@@ -262,6 +267,7 @@
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -269,7 +275,7 @@
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -282,6 +288,7 @@
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
@@ -289,6 +296,7 @@
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
@@ -296,7 +304,7 @@
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
--- 1.22/mysql-test/t/strict.test 2006-08-15 16:24:54 +08:00
+++ 1.23/mysql-test/t/strict.test 2006-08-15 16:24:54 +08:00
@@ -13,7 +13,9 @@
# Test INSERT with DATE
CREATE TABLE t1 (col1 date);
-INSERT INTO t1 VALUES('2004-01-01'),('0000-10-31'),('2004-02-29');
+INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
+--error 1292
+INSERT INTO t1 VALUES('0000-10-31');
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
@@ -97,7 +99,9 @@
# Test INSERT with DATETIME
CREATE TABLE t1 (col1 datetime);
-INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('0000-10-31 15:30:00'),('2004-02-29 15:30:00');
+INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
+--error 1292
+INSERT INTO t1 VALUES('0000-10-31 15:30:00');
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
@@ -190,6 +194,7 @@
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
+--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -211,6 +216,7 @@
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
+--error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -264,6 +270,8 @@
## Test INSERT with CAST AS DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
+
+--error 1292
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
--error 1292
@@ -290,6 +298,8 @@
## Test INSERT with CAST AS DATETIME into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
+
+--error 1292
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
--error 1292
@@ -356,6 +366,8 @@
## Test INSERT with CONVERT to DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
+
+--error 1292
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
--error 1292
@@ -381,6 +393,8 @@
## Test INSERT with CONVERT to DATETIME into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
+
+--error 1292
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
--error 1292
--- 1.8/mysql-test/r/rpl_trigger.result 2006-08-15 16:24:54 +08:00
+++ 1.9/mysql-test/r/rpl_trigger.result 2006-08-15 16:24:54 +08:00
@@ -899,3 +899,50 @@
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
RESET MASTER;
+START SLAVE;
+
+---> Test for BUG#20438
+
+---> Preparing environment...
+---> connection: master
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+
+---> Synchronizing slave with master...
+
+---> connection: master
+
+---> Creating objects...
+CREATE TABLE t1(c INT);
+CREATE TABLE t2(c INT);
+/*!50003 CREATE TRIGGER t1_bi BEFORE INSERT ON t1
+FOR EACH ROW
+INSERT INTO t2 VALUES(NEW.c * 10) */;
+
+---> Inserting value...
+INSERT INTO t1 VALUES(1);
+
+---> Checking on master...
+SELECT * FROM t1;
+c
+1
+SELECT * FROM t2;
+c
+10
+
+---> Synchronizing slave with master...
+---> connection: master
+
+---> Checking on slave...
+SELECT * FROM t1;
+c
+1
+SELECT * FROM t2;
+c
+10
+
+---> connection: master
+
+---> Cleaning up...
+DROP TABLE t1;
+DROP TABLE t2;
--- 1.8/mysql-test/t/rpl_trigger.test 2006-08-15 16:24:54 +08:00
+++ 1.9/mysql-test/t/rpl_trigger.test 2006-08-15 16:24:54 +08:00
@@ -339,6 +339,98 @@
RESET MASTER;
+# Restart slave.
+
+connection slave;
+START SLAVE;
+
+
+#
+# BUG#20438: CREATE statements for views, stored routines and triggers can be
+# not replicable.
+#
+
+--echo
+--echo ---> Test for BUG#20438
+
+# Prepare environment.
+
+--echo
+--echo ---> Preparing environment...
+--echo ---> connection: master
+--connection master
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo
+--echo ---> connection: master
+--connection master
+
+# Test.
+
+--echo
+--echo ---> Creating objects...
+
+CREATE TABLE t1(c INT);
+CREATE TABLE t2(c INT);
+
+/*!50003 CREATE TRIGGER t1_bi BEFORE INSERT ON t1
+ FOR EACH ROW
+ INSERT INTO t2 VALUES(NEW.c * 10) */;
+
+--echo
+--echo ---> Inserting value...
+
+INSERT INTO t1 VALUES(1);
+
+--echo
+--echo ---> Checking on master...
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+--echo
+--echo ---> Synchronizing slave with master...
+
+--save_master_pos
+--connection slave
+--sync_with_master
+
+--echo ---> connection: master
+
+--echo
+--echo ---> Checking on slave...
+
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+# Cleanup.
+
+--echo
+--echo ---> connection: master
+--connection master
+
+--echo
+--echo ---> Cleaning up...
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--save_master_pos
+--connection slave
+--sync_with_master
+--connection master
+
#
# End of tests
--- 1.7/mysql-test/r/udf.result 2006-08-15 16:24:54 +08:00
+++ 1.8/mysql-test/r/udf.result 2006-08-15 16:24:54 +08:00
@@ -93,6 +93,12 @@
0R
FR
DROP TABLE bug19904;
+CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
+RETURNS STRING SONAME "should_not_parse.so";
+ERROR HY000: Incorrect usage of SONAME and DEFINER
+CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
+RETURNS STRING SONAME "should_not_parse.so";
+ERROR HY000: Incorrect usage of SONAME and DEFINER
create table t1(f1 int);
insert into t1 values(1),(2);
explain select myfunc_int(f1) from t1 order by 1;
--- 1.13/mysql-test/t/mysql.test 2006-08-15 16:24:54 +08:00
+++ 1.14/mysql-test/t/mysql.test 2006-08-15 16:24:54 +08:00
@@ -77,6 +77,23 @@
#
--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
+#
+# Bug#19265 describe command does not work from mysql prompt
+#
+
+create table t1(a int, b varchar(255), c int);
+--exec $MYSQL test -e "desc t1"
+--exec $MYSQL test -e "desc t1\g"
+drop table t1;
+
+--disable_parsing
+#
+# Bug#21042 mysql client segfaults on importing a mysqldump export
+#
+--error 1
+--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
+--enable_parsing
+
--echo End of 5.0 tests
--- 1.220/client/mysqltest.c 2006-08-15 16:24:54 +08:00
+++ 1.221/client/mysqltest.c 2006-08-15 16:24:54 +08:00
@@ -5319,6 +5319,14 @@
q->require_file=require_file;
save_file[0]=0;
}
+ /*
+ To force something being sent as a query to the mysqld one can
+ use the prefix "query". Remove "query" from string before executing
+ */
+ if (strncmp(q->query, "query ", 6) == 0)
+ {
+ q->query= q->first_argument;
+ }
run_query(&cur_con->mysql, q, flags);
query_executed= 1;
q->last_argument= q->end;
--- 1.40/mysql-test/r/federated.result 2006-08-15 16:24:54 +08:00
+++ 1.41/mysql-test/r/federated.result 2006-08-15 16:24:54 +08:00
@@ -967,6 +967,8 @@
`blurb` text default '',
PRIMARY KEY (blurb_id))
DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`blurb_id` int NOT NULL DEFAULT 0,
@@ -975,6 +977,8 @@
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
CONNECTION='mysql://root@stripped:SLAVE_PORT/federated/t1';
+Warnings:
+Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. ");
--- 1.9/mysql-test/r/sp-code.result 2006-08-15 16:24:54 +08:00
+++ 1.10/mysql-test/r/sp-code.result 2006-08-15 16:24:54 +08:00
@@ -155,11 +155,11 @@
0 stmt 9 "drop temporary table if exists sudoku..."
1 stmt 1 "create temporary table sudoku_work ( ..."
2 stmt 1 "create temporary table sudoku_schedul..."
-3 stmt 95 "call sudoku_init("
+3 stmt 95 "call sudoku_init()"
4 jump_if_not 7(8) p_naive@0
5 stmt 4 "update sudoku_work set cnt = 0 where ..."
6 jump 8
-7 stmt 95 "call sudoku_count("
+7 stmt 95 "call sudoku_count()"
8 stmt 6 "insert into sudoku_schedule (row,col)..."
9 set v_scounter@2 0
10 set v_i@3 1
@@ -199,3 +199,10 @@
44 jump 14
45 stmt 9 "drop temporary table sudoku_work, sud..."
drop procedure sudoku_solve;
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1() CREATE INDEX idx ON t1 (c1);
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 stmt 2 "CREATE INDEX idx ON t1 (c1)"
+DROP PROCEDURE p1;
+End of 5.0 tests.
--- 1.34/mysql-test/r/sp-security.result 2006-08-15 16:24:54 +08:00
+++ 1.35/mysql-test/r/sp-security.result 2006-08-15 16:24:54 +08:00
@@ -441,3 +441,55 @@
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
DROP USER user19857@localhost;
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP FUNCTION IF EXISTS f_suid;
+DROP PROCEDURE IF EXISTS p_suid;
+DROP FUNCTION IF EXISTS f_evil;
+DELETE FROM mysql.user WHERE user LIKE 'mysqltest\_%';
+DELETE FROM mysql.db WHERE user LIKE 'mysqltest\_%';
+DELETE FROM mysql.tables_priv WHERE user LIKE 'mysqltest\_%';
+DELETE FROM mysql.columns_priv WHERE user LIKE 'mysqltest\_%';
+FLUSH PRIVILEGES;
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION f_suid(i INT) RETURNS INT SQL SECURITY DEFINER RETURN 0;
+CREATE PROCEDURE p_suid(IN i INT) SQL SECURITY DEFINER SET @c:= 0;
+CREATE USER mysqltest_u1@localhost;
+GRANT EXECUTE ON test.* TO mysqltest_u1@localhost;
+CREATE DEFINER=mysqltest_u1@localhost FUNCTION f_evil () RETURNS INT
+SQL SECURITY INVOKER
+BEGIN
+SET @a:= CURRENT_USER();
+SET @b:= (SELECT COUNT(*) FROM t1);
+RETURN @b;
+END|
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT f_evil();
+SELECT COUNT(*) FROM t1;
+ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
+SELECT f_evil();
+ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
+SELECT @a, @b;
+@a @b
+mysqltest_u1@localhost NULL
+SELECT f_suid(f_evil());
+ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
+SELECT @a, @b;
+@a @b
+mysqltest_u1@localhost NULL
+CALL p_suid(f_evil());
+ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
+SELECT @a, @b;
+@a @b
+mysqltest_u1@localhost NULL
+SELECT * FROM v1;
+ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v1'
+SELECT @a, @b;
+@a @b
+mysqltest_u1@localhost NULL
+DROP VIEW v1;
+DROP FUNCTION f_evil;
+DROP USER mysqltest_u1@localhost;
+DROP PROCEDURE p_suid;
+DROP FUNCTION f_suid;
+DROP TABLE t1;
+End of 5.0 tests.
--- 1.35/mysql-test/t/sp-security.test 2006-08-15 16:24:54 +08:00
+++ 1.36/mysql-test/t/sp-security.test 2006-08-15 16:24:54 +08:00
@@ -767,4 +767,80 @@
DROP USER user19857@localhost;
-# End of 5.0 bugs.
+--disconnect con1root
+--connection default
+
+
+#
+# BUG#18630: Arguments of suid routine calculated in wrong security
+# context
+#
+# Arguments of suid routines were calculated in definer's security
+# context instead of caller's context thus creating security hole.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP FUNCTION IF EXISTS f_suid;
+DROP PROCEDURE IF EXISTS p_suid;
+DROP FUNCTION IF EXISTS f_evil;
+--enable_warnings
+DELETE FROM mysql.user WHERE user LIKE 'mysqltest\_%';
+DELETE FROM mysql.db WHERE user LIKE 'mysqltest\_%';
+DELETE FROM mysql.tables_priv WHERE user LIKE 'mysqltest\_%';
+DELETE FROM mysql.columns_priv WHERE user LIKE 'mysqltest\_%';
+FLUSH PRIVILEGES;
+
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION f_suid(i INT) RETURNS INT SQL SECURITY DEFINER RETURN 0;
+CREATE PROCEDURE p_suid(IN i INT) SQL SECURITY DEFINER SET @c:= 0;
+
+CREATE USER mysqltest_u1@localhost;
+# Thanks to this grant statement privileges of anonymous users on
+# 'test' database are not applicable for mysqltest_u1@localhost.
+GRANT EXECUTE ON test.* TO mysqltest_u1@localhost;
+
+delimiter |;
+CREATE DEFINER=mysqltest_u1@localhost FUNCTION f_evil () RETURNS INT
+ SQL SECURITY INVOKER
+BEGIN
+ SET @a:= CURRENT_USER();
+ SET @b:= (SELECT COUNT(*) FROM t1);
+ RETURN @b;
+END|
+delimiter ;|
+
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT f_evil();
+
+connect (conn1, localhost, mysqltest_u1,,);
+
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT COUNT(*) FROM t1;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT f_evil();
+SELECT @a, @b;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT f_suid(f_evil());
+SELECT @a, @b;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CALL p_suid(f_evil());
+SELECT @a, @b;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM v1;
+SELECT @a, @b;
+
+disconnect conn1;
+connection default;
+
+DROP VIEW v1;
+DROP FUNCTION f_evil;
+DROP USER mysqltest_u1@localhost;
+DROP PROCEDURE p_suid;
+DROP FUNCTION f_suid;
+DROP TABLE t1;
+
+--echo End of 5.0 tests.
--- 1.118/sql/sp.cc 2006-08-15 16:24:54 +08:00
+++ 1.119/sql/sp.cc 2006-08-15 16:24:54 +08:00
@@ -497,6 +497,13 @@
table.s = &share;
field= sp->create_result_field(0, 0, &table);
field->sql_type(result);
+
+ if (field->has_charset())
+ {
+ result.append(STRING_WITH_LEN(" CHARSET "));
+ result.append(field->charset()->csname);
+ }
+
delete field;
}
@@ -628,7 +635,10 @@
log_query.append(STRING_WITH_LEN("CREATE "));
append_definer(thd, &log_query, &thd->lex->definer->user,
&thd->lex->definer->host);
- log_query.append(thd->lex->stmt_definition_begin);
+ log_query.append(thd->lex->stmt_definition_begin,
+ (char *)sp->m_body_begin -
+ thd->lex->stmt_definition_begin +
+ sp->m_body.length);
/* Such a statement can always go directly to binlog, no trans cache */
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
@@ -975,6 +985,11 @@
sp_head *new_sp;
const char *returns= "";
char definer[USER_HOST_BUFF_SIZE];
+
+ /*
+ String buffer for RETURNS data type must have system charset;
+ 64 -- size of "returns" column of mysql.proc.
+ */
String retstr(64);
DBUG_PRINT("info", ("found: 0x%lx", (ulong)sp));
--- 1.89/sql/sp_head.h 2006-08-15 16:24:54 +08:00
+++ 1.90/sql/sp_head.h 2006-08-15 16:24:54 +08:00
@@ -195,9 +195,13 @@
void
init(LEX *lex);
+ /* Copy sp name from parser. */
+ void
+ init_sp_name(THD *thd, sp_name *spname);
+
// Initialize strings after parsing header
void
- init_strings(THD *thd, LEX *lex, sp_name *name);
+ init_strings(THD *thd, LEX *lex);
int
create(THD *thd);
@@ -209,6 +213,10 @@
destroy();
bool
+ execute_trigger(THD *thd, const char *db, const char *table,
+ GRANT_INFO *grant_onfo);
+
+ bool
execute_function(THD *thd, Item **args, uint argcount, Field *return_fld);
bool
@@ -1170,6 +1178,10 @@
Security_context **backup);
void
sp_restore_security_context(THD *thd, Security_context *backup);
+
+bool
+set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc,
+ Security_context **save_ctx);
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
TABLE_LIST *
--- 1.20/mysql-test/r/gis-rtree.result 2006-08-15 16:24:54 +08:00
+++ 1.21/mysql-test/r/gis-rtree.result 2006-08-15 16:24:54 +08:00
@@ -804,6 +804,8 @@
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
@@ -820,6 +822,8 @@
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
@@ -834,6 +838,8 @@
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
--- 1.34/mysql-test/r/gis.result 2006-08-15 16:24:54 +08:00
+++ 1.35/mysql-test/r/gis.result 2006-08-15 16:24:54 +08:00
@@ -225,8 +225,8 @@
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
Warnings:
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
SELECT fid, X(g) FROM gis_point;
@@ -242,8 +242,8 @@
103 20
104 20
explain extended select X(g),Y(g) FROM gis_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
@@ -277,8 +277,8 @@
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
@@ -307,8 +307,8 @@
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, IsClosed(g) FROM gis_multi_line;
@@ -346,8 +346,8 @@
120 2
121 2
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
@@ -374,8 +374,8 @@
120 POINT(0 0)
121 POINT(44 6)
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
@@ -393,9 +393,9 @@
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE g2 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
@@ -436,26 +436,26 @@
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
POINT(1 4)
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
SRID(GeomFromText('LineString(1 1,2 2)',101))
101
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
--- 1.252/BitKeeper/etc/ignore 2006-08-15 16:24:54 +08:00
+++ 1.253/BitKeeper/etc/ignore 2006-08-15 16:24:54 +08:00
@@ -943,6 +943,7 @@
ndb/src/common/portlib/libportlib.dsp
ndb/src/common/transporter/libtransporter.dsp
ndb/src/common/util/libgeneral.dsp
+ndb/src/common/util/testBitmask.cpp
ndb/src/cw/cpcd/ndb_cpcd
ndb/src/dummy.cpp
ndb/src/kernel/blocks/backup/libbackup.dsp
--- 1.39/mysql-test/r/user_var.result 2006-08-15 16:24:54 +08:00
+++ 1.40/mysql-test/r/user_var.result 2006-08-15 16:24:54 +08:00
@@ -256,3 +256,39 @@
`@first_var` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+set @a=18446744071710965857;
+select @a;
+@a
+18446744071710965857
+CREATE TABLE `bigfailure` (
+`afield` BIGINT UNSIGNED NOT NULL
+);
+INSERT INTO `bigfailure` VALUES (18446744071710965857);
+SELECT * FROM bigfailure;
+afield
+18446744071710965857
+select * from (SELECT afield FROM bigfailure) as b;
+afield
+18446744071710965857
+select * from bigfailure where afield = (SELECT afield FROM bigfailure);
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965857;
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965856+1;
+afield
+18446744071710965857
+SET @a := (SELECT afield FROM bigfailure);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
+SELECT @a;
+@a
+18446744071710965857
+drop table bigfailure;
--- 1.68/mysql-test/t/ps.test 2006-08-15 16:24:54 +08:00
+++ 1.69/mysql-test/t/ps.test 2006-08-15 16:24:54 +08:00
@@ -491,6 +491,7 @@
drop table t1, t2;
#
+#
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
# tables"
# Check that multi-delete tables are also cleaned up before re-execution.
@@ -538,86 +539,6 @@
deallocate prepare stmt;
#
-# Bug#8115: equality propagation and prepared statements
-#
-
-create table t1 (a char(3) not null, b char(3) not null,
- c char(3) not null, primary key (a, b, c));
-create table t2 like t1;
-
-# reduced query
-prepare stmt from
- "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
- where t1.a=1";
-execute stmt;
-execute stmt;
-execute stmt;
-
-# original query
-prepare stmt from
-"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
-(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
-left outer join t2 t3 on t3.a=? where t1.a=?";
-
-set @a:=1, @b:=1, @c:=1;
-
-execute stmt using @a, @b, @c;
-execute stmt using @a, @b, @c;
-execute stmt using @a, @b, @c;
-
-deallocate prepare stmt;
-
-drop table t1,t2;
-
-
-#
-# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
-#
-
-eval SET @aux= "SELECT COUNT(*)
- FROM INFORMATION_SCHEMA.COLUMNS A,
- INFORMATION_SCHEMA.COLUMNS B
- WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
- AND A.TABLE_NAME = B.TABLE_NAME
- AND A.COLUMN_NAME = B.COLUMN_NAME AND
- A.TABLE_NAME = 'user'";
-
-let $exec_loop_count= 3;
-eval prepare my_stmt from @aux;
-while ($exec_loop_count)
-{
- eval execute my_stmt;
- dec $exec_loop_count;
-}
-deallocate prepare my_stmt;
-
-# Test CALL in prepared mode
-delimiter |;
---disable_warnings
-drop procedure if exists p1|
-drop table if exists t1|
---enable_warnings
-create table t1 (id int)|
-insert into t1 values(1)|
-create procedure p1(a int, b int)
-begin
- declare c int;
- select max(id)+1 into c from t1;
- insert into t1 select a+b;
- insert into t1 select a-b;
- insert into t1 select a-c;
-end|
-set @a= 3, @b= 4|
-prepare stmt from "call p1(?, ?)"|
-execute stmt using @a, @b|
-execute stmt using @a, @b|
-select * from t1|
-deallocate prepare stmt|
-drop procedure p1|
-drop table t1|
-delimiter ;|
-
-#
# Bug#9096 "select doesn't return all matched records if prepared statements
# is used"
# The bug was is bad co-operation of the optimizer's algorithm which determines
@@ -692,35 +613,6 @@
drop table t1, t2;
#
-# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
-# support for placeholders in LIMIT clause."
-# Add basic test coverage for the feature.
-#
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-prepare stmt from "select * from t1 limit ?, ?";
-set @offset=0, @limit=1;
-execute stmt using @offset, @limit;
-select * from t1 limit 0, 1;
-set @offset=3, @limit=2;
-execute stmt using @offset, @limit;
-select * from t1 limit 3, 2;
-prepare stmt from "select * from t1 limit ?";
-execute stmt using @limit;
---error 1235
-prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
-prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
-set @offset=9;
-set @limit=2;
-execute stmt using @offset, @limit;
-prepare stmt from "(select * from t1 limit ?, ?) union all
- (select * from t1 limit ?, ?) order by a limit ?";
-execute stmt using @offset, @limit, @offset, @limit, @limit;
-
-drop table t1;
-deallocate prepare stmt;
-
-#
# Bug#11060 "Server crashes on calling stored procedure with INSERT SELECT
# UNION SELECT" aka "Server crashes on re-execution of prepared INSERT ...
# SELECT with UNION".
@@ -837,22 +729,6 @@
select ? from t1;
--enable_ps_protocol
drop table t1;
-
-#
-# Bug#12651
-# (Crash on a PS including a subquery which is a select from a simple view)
-#
-CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
-CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
-CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
-
-PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
-EXECUTE b12651;
-
-DROP VIEW b12651_V1;
-DROP TABLE b12651_T1, b12651_T2;
-DEALLOCATE PREPARE b12651;
-
#
# Bug#9359 "Prepared statements take snapshot of system vars at PREPARE
# time"
@@ -1087,7 +963,172 @@
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
--enable_ps_protocol
-# End of 4.1 tests
+#
+# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
+# tables"
+# Check that multi-delete tables are also cleaned up before re-execution.
+#
+--disable_warnings
+drop table if exists t1;
+create temporary table if not exists t1 (a1 int);
+--enable_warnings
+# exact delete syntax is essential
+prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+# the server crashed on the next statement without the fix
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+# the problem was in memory corruption: repeat the test just in case
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+execute stmt;
+drop temporary table t1;
+deallocate prepare stmt;
+
+--echo End of 4.1 tests
+############################# 5.0 tests start ################################
+#
+#
+# Bug#6102 "Server crash with prepared statement and blank after
+# function name"
+# ensure that stored functions are cached when preparing a statement
+# before we open tables
+#
+create table t1 (a varchar(20));
+insert into t1 values ('foo');
+--error 1305
+prepare stmt FROM 'SELECT char_length (a) FROM t1';
+drop table t1;
+
+#
+# Bug#8115: equality propagation and prepared statements
+#
+
+create table t1 (a char(3) not null, b char(3) not null,
+ c char(3) not null, primary key (a, b, c));
+create table t2 like t1;
+
+# reduced query
+prepare stmt from
+ "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
+ where t1.a=1";
+execute stmt;
+execute stmt;
+execute stmt;
+
+# original query
+prepare stmt from
+"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
+(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
+left outer join t2 t3 on t3.a=? where t1.a=?";
+
+set @a:=1, @b:=1, @c:=1;
+
+execute stmt using @a, @b, @c;
+execute stmt using @a, @b, @c;
+execute stmt using @a, @b, @c;
+
+deallocate prepare stmt;
+
+drop table t1,t2;
+
+
+#
+# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
+#
+
+eval SET @aux= "SELECT COUNT(*)
+ FROM INFORMATION_SCHEMA.COLUMNS A,
+ INFORMATION_SCHEMA.COLUMNS B
+ WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
+ AND A.TABLE_NAME = B.TABLE_NAME
+ AND A.COLUMN_NAME = B.COLUMN_NAME AND
+ A.TABLE_NAME = 'user'";
+
+let $exec_loop_count= 3;
+eval prepare my_stmt from @aux;
+while ($exec_loop_count)
+{
+ eval execute my_stmt;
+ dec $exec_loop_count;
+}
+deallocate prepare my_stmt;
+
+# Test CALL in prepared mode
+delimiter |;
+--disable_warnings
+drop procedure if exists p1|
+drop table if exists t1|
+--enable_warnings
+create table t1 (id int)|
+insert into t1 values(1)|
+create procedure p1(a int, b int)
+begin
+ declare c int;
+ select max(id)+1 into c from t1;
+ insert into t1 select a+b;
+ insert into t1 select a-b;
+ insert into t1 select a-c;
+end|
+set @a= 3, @b= 4|
+prepare stmt from "call p1(?, ?)"|
+execute stmt using @a, @b|
+execute stmt using @a, @b|
+select * from t1|
+deallocate prepare stmt|
+drop procedure p1|
+drop table t1|
+delimiter ;|
+
+
+#
+# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
+# support for placeholders in LIMIT clause."
+# Add basic test coverage for the feature.
+#
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+prepare stmt from "select * from t1 limit ?, ?";
+set @offset=0, @limit=1;
+execute stmt using @offset, @limit;
+select * from t1 limit 0, 1;
+set @offset=3, @limit=2;
+execute stmt using @offset, @limit;
+select * from t1 limit 3, 2;
+prepare stmt from "select * from t1 limit ?";
+execute stmt using @limit;
+--error 1235
+prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
+prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
+set @offset=9;
+set @limit=2;
+execute stmt using @offset, @limit;
+prepare stmt from "(select * from t1 limit ?, ?) union all
+ (select * from t1 limit ?, ?) order by a limit ?";
+execute stmt using @offset, @limit, @offset, @limit, @limit;
+
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Bug#12651
+# (Crash on a PS including a subquery which is a select from a simple view)
+#
+CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
+CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
+CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
+
+PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
+EXECUTE b12651;
+
+DROP VIEW b12651_V1;
+DROP TABLE b12651_T1, b12651_T2;
+DEALLOCATE PREPARE b12651;
+
+
#
# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared
--- 1.10/extra/yassl/src/yassl_imp.cpp 2006-08-15 16:24:54 +08:00
+++ 1.11/extra/yassl/src/yassl_imp.cpp 2006-08-15 16:24:54 +08:00
@@ -1172,7 +1172,8 @@
// Session
hello.id_len_ = input[AUTO];
- input.read(hello.session_id_, ID_LEN);
+ if (hello.id_len_)
+ input.read(hello.session_id_, hello.id_len_);
// Suites
hello.cipher_suite_[0] = input[AUTO];
@@ -1215,7 +1216,10 @@
{
ssl.set_pending(cipher_suite_[1]);
ssl.set_random(random_, server_end);
+ if (id_len_)
ssl.set_sessionID(session_id_);
+ else
+ ssl.useSecurity().use_connection().sessionID_Set_ = false;
if (ssl.getSecurity().get_resuming())
if (memcmp(session_id_, ssl.getSecurity().get_resume().GetID(),
--- 1.21/extra/yassl/src/yassl_int.cpp 2006-08-15 16:24:54 +08:00
+++ 1.22/extra/yassl/src/yassl_int.cpp 2006-08-15 16:24:54 +08:00
@@ -709,6 +709,7 @@
void SSL::set_sessionID(const opaque* sessionID)
{
memcpy(secure_.use_connection().sessionID_, sessionID, ID_LEN);
+ secure_.use_connection().sessionID_Set_ = true;
}
@@ -1423,8 +1424,10 @@
void Sessions::add(const SSL& ssl)
{
+ if (ssl.getSecurity().get_connection().sessionID_Set_) {
Lock guard(mutex_);
list_.push_back(NEW_YS SSL_SESSION(ssl, random_));
+ }
}
--- 1.174/sql/sql_prepare.cc 2006-08-15 16:24:54 +08:00
+++ 1.175/sql/sql_prepare.cc 2006-08-15 16:24:54 +08:00
@@ -2134,29 +2134,21 @@
they have their own table list).
*/
for (TABLE_LIST *tables= lex->query_tables;
- tables;
- tables= tables->next_global)
+ tables;
+ tables= tables->next_global)
+ {
+ tables->reinit_before_use(thd);
+ }
+ /*
+ Cleanup of the special case of DELETE t1, t2 FROM t1, t2, t3 ...
+ (multi-delete). We do a full clean up, although at the moment all we
+ need to clean in the tables of MULTI-DELETE list is 'table' member.
+ */
+ for (TABLE_LIST *tables= (TABLE_LIST*) lex->auxiliary_table_list.first;
+ tables;
+ tables= tables->next_global)
{
- /*
- Reset old pointers to TABLEs: they are not valid since the tables
- were closed in the end of previous prepare or execute call.
- */
tables->reinit_before_use(thd);
-
- /* Reset is_schema_table_processed value(needed for I_S tables */
- tables->is_schema_table_processed= FALSE;
-
- TABLE_LIST *embedded; /* The table at the current level of nesting. */
- TABLE_LIST *embedding= tables; /* The parent nested table reference. */
- do
- {
- embedded= embedding;
- if (embedded->prep_on_expr)
- embedded->on_expr= embedded->prep_on_expr->copy_andor_structure(thd);
- embedding= embedded->embedding;
- }
- while (embedding &&
- embedding->nested_join->join_list.head() == embedded);
}
lex->current_select= &lex->select_lex;
@@ -2171,7 +2163,7 @@
}
lex->allow_sum_func= 0;
lex->in_sum_func= NULL;
- DBUG_VOID_RETURN;
+ DBUG_VOID_RETURN;
}
--- 1.19/mysql-test/r/func_compress.result 2006-08-15 16:24:54 +08:00
+++ 1.20/mysql-test/r/func_compress.result 2006-08-15 16:24:54 +08:00
@@ -8,16 +8,16 @@
uncompress(compress(@test_compress_string))
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
explain extended select uncompress(compress(@test_compress_string));
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
select uncompressed_length(compress(@test_compress_string));
| Thread |
|---|
| • bk commit into 5.1 tree (dli:1.2274) | dli | 15 Aug |