List:Commits« Previous MessageNext Message »
From:Elliot Murphy Date:January 30 2006 1:48pm
Subject:bk commit into 5.1 tree (elliot:1.2089)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of emurphy. When emurphy does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2089 06/01/30 08:47:17 elliot@stripped +116 -0
  Merge mysql.com:/home/emurphy/src/mysql/bk-clean/mysql-5.0
  into  mysql.com:/home/emurphy/src/mysql/bk-clean/mysql-5.1-new

  storage/innobase/lock/lock0lock.c
    1.65 06/01/30 08:46:32 elliot@stripped +0 -70
    manual merge

  sql/sql_yacc.yy
    1.447 06/01/30 08:46:31 elliot@stripped +5 -0
    manual merge

  sql/sql_trigger.cc
    1.44 06/01/30 08:46:31 elliot@stripped +23 -3
    manual merge

  sql/sql_repl.cc
    1.149 06/01/30 08:46:31 elliot@stripped +0 -1
    manual merge

  sql/sql_insert.cc
    1.186 06/01/30 08:46:31 elliot@stripped +0 -0
    manual merge

  sql/share/errmsg.txt
    1.78 06/01/30 08:46:31 elliot@stripped +9 -8
    manual merge

  sql/set_var.cc
    1.162 06/01/30 08:46:31 elliot@stripped +194 -62
    manual merge

  sql/item_func.cc
    1.272 06/01/30 08:46:31 elliot@stripped +0 -0
    manual merge

  sql/item.cc
    1.165 06/01/30 08:46:31 elliot@stripped +0 -1
    manual merge

  sql/ha_innodb.cc
    1.251 06/01/30 08:46:31 elliot@stripped +61 -98
    manual merge

  sql/ha_archive.cc
    1.76 06/01/30 08:46:31 elliot@stripped +0 -2
    manual merge

  sql/field.cc
    1.298 06/01/30 08:46:31 elliot@stripped +2 -5
    manual merge

  mysys/my_bitmap.c
    1.37 06/01/30 08:46:31 elliot@stripped +10 -1
    manual merge

  mysql-test/t/information_schema.test
    1.69 06/01/30 08:46:31 elliot@stripped +0 -0
    manual merge

  mysql-test/t/alter_table.test
    1.46 06/01/30 08:46:31 elliot@stripped +3 -4
    manual merge

  mysql-test/r/information_schema.result
    1.104 06/01/30 08:46:31 elliot@stripped +1 -14
    skipping merge, will update result files after merge

  mysql-test/r/alter_table.result
    1.59 06/01/30 08:46:31 elliot@stripped +0 -4
    skipping merge, will update result files after merge.

  mysql-test/mysql-test-run.pl
    1.58 06/01/30 08:46:31 elliot@stripped +0 -0
    manual merge

  VC++Files/sql/mysqld.vcproj
    1.8 06/01/30 08:46:31 elliot@stripped +0 -0
    manual merge

  zlib/Makefile.am
    1.8 06/01/30 08:27:43 elliot@stripped +0 -0
    Auto merged

  tests/mysql_client_test.c
    1.169 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/tools/ndb_size.pl
    1.6 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/main.cpp
    1.48 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/Services.hpp
    1.18 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/Services.cpp
    1.58 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.40 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.89 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmclient/CommandInterpreter.cpp
    1.59 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmapi/mgmapi.cpp
    1.59 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/vm/Configuration.hpp
    1.18 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/vm/Configuration.cpp
    1.44 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/main.cpp
    1.57 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/common/util/SocketServer.cpp
    1.19 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
    1.33 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/SysLogHandler.cpp
    1.6 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/Logger.cpp
    1.14 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/LogHandler.cpp
    1.13 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/src/common/logger/FileLogHandler.cpp
    1.11 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/include/mgmcommon/ConfigRetriever.hpp
    1.19 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/include/mgmapi/mgmapi.h
    1.49 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/include/logger/Logger.hpp
    1.8 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/ndb/include/logger/LogHandler.hpp
    1.8 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/myisam/sort.c
    1.51 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/myisam/myisampack.c
    1.52 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/myisam/mi_delete.c
    1.39 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/myisam/ft_update.c
    1.41 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/innobase/trx/trx0trx.c
    1.62 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/innobase/srv/srv0srv.c
    1.96 06/01/30 08:27:42 elliot@stripped +0 -0
    Auto merged

  storage/innobase/row/row0sel.c
    1.100 06/01/30 08:27:41 elliot@stripped +0 -1
    Auto merged

  storage/innobase/row/row0mysql.c
    1.120 06/01/30 08:27:41 elliot@stripped +0 -2
    Auto merged

  storage/innobase/row/row0ins.c
    1.75 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  storage/innobase/os/os0file.c
    1.112 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  storage/innobase/include/srv0srv.h
    1.59 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  storage/innobase/include/row0mysql.h
    1.46 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  storage/innobase/include/os0file.h
    1.43 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  storage/innobase/include/lock0lock.h
    1.26 06/01/30 08:27:41 elliot@stripped +0 -12
    Auto merged

  storage/innobase/include/data0type.ic
    1.28 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  storage/innobase/include/data0type.h
    1.23 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  sql/table.h
    1.126 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  sql/table.cc
    1.205 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  sql-common/client.c
    1.83 06/01/30 08:27:41 elliot@stripped +0 -0
    Auto merged

  sql/sql_test.cc
    1.45 06/01/30 08:27:40 elliot@stripped +0 -0
    Auto merged

  sql/sql_table.cc
    1.299 06/01/30 08:27:40 elliot@stripped +0 -0
    Auto merged

  sql/sql_show.cc
    1.294 06/01/30 08:27:40 elliot@stripped +0 -0
    Auto merged

  sql/sql_select.cc
    1.384 06/01/30 08:27:40 elliot@stripped +0 -0
    Auto merged

  sql/sql_prepare.cc
    1.160 06/01/30 08:27:39 elliot@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.515 06/01/30 08:27:39 elliot@stripped +0 -0
    Auto merged

  sql/sql_help.cc
    1.52 06/01/30 08:27:39 elliot@stripped +0 -0
    Auto merged

  sql/sql_handler.cc
    1.80 06/01/30 08:27:39 elliot@stripped +0 -0
    Auto merged

  sql/sql_db.cc
    1.126 06/01/30 08:27:39 elliot@stripped +0 -0
    Auto merged

  sql/sql_acl.cc
    1.176 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/sp_head.h
    1.78 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/sp_head.cc
    1.199 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/slave.h
    1.94 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/slave.cc
    1.263 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/repl_failsafe.cc
    1.63 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/protocol.cc
    1.113 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/opt_range.h
    1.60 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/opt_range.cc
    1.198 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.527 06/01/30 08:27:38 elliot@stripped +0 -0
    Auto merged

  sql/log_event.cc
    1.202 06/01/30 08:27:37 elliot@stripped +0 -0
    Auto merged

  sql/item.h
    1.190 06/01/30 08:27:37 elliot@stripped +0 -0
    Auto merged

  sql/ha_myisam.cc
    1.171 06/01/30 08:27:37 elliot@stripped +0 -0
    Auto merged

  sql/ha_innodb.h
    1.116 06/01/30 08:27:37 elliot@stripped +0 -0
    Auto merged

  sql/ha_berkeley.cc
    1.169 06/01/30 08:27:37 elliot@stripped +0 -0
    Auto merged

  sql/field.h
    1.175 06/01/30 08:27:37 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/trigger-grant.test
    1.4 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/sp.test
    1.173 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/sp-error.test
    1.102 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/rpl_sp.test
    1.15 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/ps.test
    1.59 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/mysqltest.test
    1.32 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/innodb.test
    1.124 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/ctype_ucs.test
    1.38 06/01/30 08:27:36 elliot@stripped +0 -2
    Auto merged

  mysql-test/t/create.test
    1.76 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/view_grant.result
    1.11 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/variables.result
    1.78 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/type_float.result
    1.44 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/type_decimal.result
    1.40 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/sp.result
    1.181 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/sp-error.result
    1.101 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/rpl_sp.result
    1.18 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/ps.result
    1.60 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/mysqltest.result
    1.27 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/innodb.result
    1.155 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/information_schema_db.result
    1.10 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/ctype_ucs.result
    1.42 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/create.result
    1.114 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  mysql-test/ndb/ndbcluster.sh
    1.48 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  libmysql/libmysql.c
    1.233 06/01/30 08:27:36 elliot@stripped +0 -0
    Auto merged

  include/my_base.h
    1.82 06/01/30 08:27:35 elliot@stripped +0 -0
    Auto merged

  configure.in
    1.334 06/01/30 08:27:35 elliot@stripped +0 -0
    Auto merged

  client/mysqltest.c
    1.175 06/01/30 08:27:35 elliot@stripped +0 -0
    Auto merged

  client/mysqldump.c
    1.221 06/01/30 08:27:35 elliot@stripped +0 -0
    Auto merged

  client/mysqlbinlog.cc
    1.127 06/01/30 08:27:35 elliot@stripped +0 -0
    Auto merged

  storage/ndb/tools/ndb_size.pl
    1.2.3.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/tools/ndb_size.pl -> storage/ndb/tools/ndb_size.pl

  storage/ndb/src/mgmsrv/main.cpp
    1.41.6.3 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/main.cpp -> storage/ndb/src/mgmsrv/main.cpp

  storage/ndb/src/mgmsrv/Services.hpp
    1.13.3.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/Services.hpp -> storage/ndb/src/mgmsrv/Services.hpp

  storage/ndb/src/mgmsrv/Services.cpp
    1.45.13.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/Services.cpp -> storage/ndb/src/mgmsrv/Services.cpp

  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
    1.30.9.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.hpp -> storage/ndb/src/mgmsrv/MgmtSrvr.hpp

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
    1.73.17.3 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.cpp -> storage/ndb/src/mgmsrv/MgmtSrvr.cpp

  storage/ndb/src/mgmclient/CommandInterpreter.cpp
    1.49.7.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/mgmclient/CommandInterpreter.cpp -> storage/ndb/src/mgmclient/CommandInterpreter.cpp

  storage/ndb/src/mgmapi/mgmapi.cpp
    1.44.14.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/mgmapi/mgmapi.cpp -> storage/ndb/src/mgmapi/mgmapi.cpp

  storage/ndb/src/kernel/vm/Configuration.hpp
    1.15.2.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/kernel/vm/Configuration.hpp -> storage/ndb/src/kernel/vm/Configuration.hpp

  storage/ndb/src/kernel/vm/Configuration.cpp
    1.39.2.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/kernel/vm/Configuration.cpp -> storage/ndb/src/kernel/vm/Configuration.cpp

  storage/ndb/src/kernel/main.cpp
    1.48.9.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/kernel/main.cpp -> storage/ndb/src/kernel/main.cpp

  storage/ndb/src/common/util/SocketServer.cpp
    1.15.3.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/common/util/SocketServer.cpp -> storage/ndb/src/common/util/SocketServer.cpp

  storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
    1.24.8.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/common/mgmcommon/ConfigRetriever.cpp -> storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp

  storage/ndb/src/common/logger/SysLogHandler.cpp
    1.4.1.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/common/logger/SysLogHandler.cpp -> storage/ndb/src/common/logger/SysLogHandler.cpp

  storage/ndb/src/common/logger/Logger.cpp
    1.10.4.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/common/logger/Logger.cpp -> storage/ndb/src/common/logger/Logger.cpp

  storage/ndb/src/common/logger/LogHandler.cpp
    1.8.4.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/common/logger/LogHandler.cpp -> storage/ndb/src/common/logger/LogHandler.cpp

  storage/ndb/src/common/logger/FileLogHandler.cpp
    1.9.1.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/src/common/logger/FileLogHandler.cpp -> storage/ndb/src/common/logger/FileLogHandler.cpp

  storage/ndb/include/mgmcommon/ConfigRetriever.hpp
    1.16.2.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/include/mgmcommon/ConfigRetriever.hpp -> storage/ndb/include/mgmcommon/ConfigRetriever.hpp

  storage/ndb/include/mgmapi/mgmapi.h
    1.42.5.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/include/mgmapi/mgmapi.h -> storage/ndb/include/mgmapi/mgmapi.h

  storage/ndb/include/logger/Logger.hpp
    1.6.1.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/include/logger/Logger.hpp -> storage/ndb/include/logger/Logger.hpp

  storage/ndb/include/logger/LogHandler.hpp
    1.6.1.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: ndb/include/logger/LogHandler.hpp -> storage/ndb/include/logger/LogHandler.hpp

  storage/myisam/sort.c
    1.45.5.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: myisam/sort.c -> storage/myisam/sort.c

  storage/myisam/myisampack.c
    1.39.13.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: myisam/myisampack.c -> storage/myisam/myisampack.c

  storage/myisam/mi_delete.c
    1.33.6.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: myisam/mi_delete.c -> storage/myisam/mi_delete.c

  storage/myisam/ft_update.c
    1.37.1.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: myisam/ft_update.c -> storage/myisam/ft_update.c

  storage/innobase/trx/trx0trx.c
    1.54.8.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/trx/trx0trx.c -> storage/innobase/trx/trx0trx.c

  storage/innobase/srv/srv0srv.c
    1.87.9.3 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/srv/srv0srv.c -> storage/innobase/srv/srv0srv.c

  storage/innobase/row/row0sel.c
    1.92.5.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/row/row0sel.c -> storage/innobase/row/row0sel.c

  storage/innobase/row/row0ins.c
    1.65.10.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/row/row0ins.c -> storage/innobase/row/row0ins.c

  storage/innobase/os/os0file.c
    1.103.7.3 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/os/os0file.c -> storage/innobase/os/os0file.c

  storage/innobase/lock/lock0lock.c
    1.55.7.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/lock/lock0lock.c -> storage/innobase/lock/lock0lock.c

  storage/innobase/include/srv0srv.h
    1.51.7.3 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/include/srv0srv.h -> storage/innobase/include/srv0srv.h

  storage/innobase/include/row0mysql.h
    1.39.5.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/include/row0mysql.h -> storage/innobase/include/row0mysql.h

  storage/innobase/include/os0file.h
    1.34.7.3 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/include/os0file.h -> storage/innobase/include/os0file.h

  storage/innobase/include/lock0lock.h
    1.21.3.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/include/lock0lock.h -> storage/innobase/include/lock0lock.h

  storage/innobase/include/data0type.ic
    1.24.3.2 06/01/30 08:27:34 elliot@stripped +0 -0
    Merge rename: innobase/include/data0type.ic -> storage/innobase/include/data0type.ic

  storage/innobase/row/row0mysql.c
    1.103.12.2 06/01/30 08:27:33 elliot@stripped +0 -0
    Merge rename: innobase/row/row0mysql.c -> storage/innobase/row/row0mysql.c

  storage/innobase/include/data0type.h
    1.20.2.2 06/01/30 08:27:33 elliot@stripped +0 -0
    Merge rename: innobase/include/data0type.h -> storage/innobase/include/data0type.h

  BitKeeper/etc/ignore
    1.224 06/01/30 08:27:20 elliot@stripped +0 -141
    auto-union

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	elliot
# Host:	xan.(none)
# Root:	/home/emurphy/src/mysql/bk-clean/mysql-5.1-new/RESYNC

--- 1.220/client/mysqldump.c	2006-01-13 11:04:31 -05:00
+++ 1.221/client/mysqldump.c	2006-01-30 08:27:35 -05:00
@@ -1311,7 +1311,7 @@
   fprintf(sql_file, "DELIMITER ;\n");
 
   if (lock_tables)
-    mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
+    VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
   DBUG_RETURN(0);
 }
 
@@ -2134,7 +2134,10 @@
     else
       res=mysql_store_result(sock);
     if (!res)
+    {
       DB_error(sock, "when retrieving data from server");
+      goto err;
+    }
     if (verbose)
       fprintf(stderr, "-- Retrieving rows...\n");
     if (mysql_num_fields(res) != num_fields)
@@ -2664,7 +2667,7 @@
     check_io(md_result_file);
   }
   if (lock_tables)
-    mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
+    VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
   return 0;
 } /* dump_all_tables_in_db */
 
@@ -2719,23 +2722,23 @@
     check_io(md_result_file);
   }
   if (lock_tables)
-    mysql_query(sock,"UNLOCK TABLES");
+    VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
   return 0;
 } /* dump_all_tables_in_db */
 
 
 /*
-  get_actual_table_name -- executes a SHOW TABLES LIKE '%s' to get the actual 
-  table name from the server for the table name given on the command line.  
-  we do this because the table name given on the command line may be a 
+  get_actual_table_name -- executes a SHOW TABLES LIKE '%s' to get the actual
+  table name from the server for the table name given on the command line.
+  we do this because the table name given on the command line may be a
   different case (e.g.  T1 vs t1)
-  
+
   RETURN
     int - 0 if a tablename was retrieved.  1 if not
 */
 
-static int get_actual_table_name(const char *old_table_name, 
-                                  char *new_table_name, 
+static int get_actual_table_name(const char *old_table_name,
+                                  char *new_table_name,
                                   int buf_size)
 {
   int retval;
@@ -2747,7 +2750,7 @@
 
   /* Check memory for quote_for_like() */
   DBUG_ASSERT(2*sizeof(old_table_name) < sizeof(show_name_buff));
-  my_snprintf(query, sizeof(query), "SHOW TABLES LIKE %s", 
+  my_snprintf(query, sizeof(query), "SHOW TABLES LIKE %s",
 	      quote_for_like(old_table_name, show_name_buff));
 
   if (mysql_query_with_error_report(sock, 0, query))
@@ -2756,7 +2759,7 @@
   }
 
   retval = 1;
-  
+
   if ((table_res= mysql_store_result(sock)))
   {
     my_ulonglong num_rows= mysql_num_rows(table_res);
@@ -2878,7 +2881,7 @@
     check_io(md_result_file);
   }
   if (lock_tables)
-    mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
+    VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
   DBUG_RETURN(0);
 } /* dump_selected_tables */
 

--- 1.333/configure.in	2006-01-20 10:36:57 -05:00
+++ 1.334/configure.in	2006-01-30 08:27:35 -05:00
@@ -13,7 +13,8 @@
 PROTOCOL_VERSION=10
 DOT_FRM_VERSION=6
 # See the libtool docs for information on how to do shared lib versions.
-SHARED_LIB_VERSION=15:0:0
+SHARED_LIB_MAJOR_VERSION=15
+SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
 
 # Set all version vars based on $VERSION. How do we do this more elegant ?
 # Remember that regexps needs to quote [ and ] since this is run through m4
@@ -60,6 +61,7 @@
 AC_SUBST(DOT_FRM_VERSION)
 AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
                    [Version of .frm files])
+AC_SUBST(SHARED_LIB_MAJOR_VERSION)
 AC_SUBST(SHARED_LIB_VERSION)
 AC_SUBST(AVAILABLE_LANGUAGES)
 
@@ -338,6 +340,13 @@
 fi
 
 MYSQL_PROG_AR
+
+# libmysqlclient versioning when linked with GNU ld.
+if $LD --version 2>/dev/null|grep -q GNU; then
+  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmysql/libmysql.ver"
+  AC_CONFIG_FILES(libmysql/libmysql.ver)
+fi
+AC_SUBST(LD_VERSION_SCRIPT)
 
 # Avoid bug in fcntl on some versions of linux
 AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")

--- 1.81/include/my_base.h	2006-01-18 21:55:59 -05:00
+++ 1.82/include/my_base.h	2006-01-30 08:27:35 -05:00
@@ -426,7 +426,8 @@
 enum en_fieldtype {
   FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
   FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
-  FIELD_VARCHAR,FIELD_CHECK
+  FIELD_VARCHAR,FIELD_CHECK,
+  FIELD_enum_val_count
 };
 
 enum data_file_type {

--- 1.232/libmysql/libmysql.c	2006-01-18 07:14:58 -05:00
+++ 1.233/libmysql/libmysql.c	2006-01-30 08:27:36 -05:00
@@ -2722,13 +2722,13 @@
     /* Send row request to the server */
     int4store(buff, stmt->stmt_id);
     int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */
-    if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
-                             NullS, 0, 1))
+    if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
+                                            buff, sizeof(buff), NullS, 0, 1))
     {
       set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
       return 1;
     }
-    if (cli_read_binary_rows(stmt))
+    if ((*mysql->methods->read_rows_from_cursor)(stmt))
       return 1;
     stmt->server_status= mysql->server_status;
 
@@ -5101,9 +5101,9 @@
   DBUG_ENTER("mysql_autocommit");
   DBUG_PRINT("enter", ("mode : %d", auto_mode));
 
-  if (auto_mode) /* set to true */
-    DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=1", 16));
-  DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=0", 16));
+  DBUG_RETURN((my_bool) mysql_real_query(mysql, auto_mode ?
+                                         "set autocommit=1":"set autocommit=0",
+                                         16));
 }
 
 

--- 1.37.1.1/myisam/ft_update.c	2006-01-23 11:06:00 -05:00
+++ 1.41/storage/myisam/ft_update.c	2006-01-30 08:27:42 -05:00
@@ -96,18 +96,22 @@
 /* parses a document i.e. calls ft_parse for every keyseg */
 
 uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr,
-                  const byte *record, my_bool with_alloc)
+                  const byte *record, my_bool with_alloc,
+                  MYSQL_FTPARSER_PARAM *param)
 {
   FT_SEG_ITERATOR ftsi;
+  struct st_mysql_ftparser *parser;
   DBUG_ENTER("_mi_ft_parse");
 
   _mi_ft_segiterator_init(info, keynr, record, &ftsi);
 
   ft_parse_init(parsed, info->s->keyinfo[keynr].seg->charset);
+  parser= info->s->keyinfo[keynr].parser;
   while (_mi_ft_segiterator(&ftsi))
   {
     if (ftsi.pos)
-      if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, with_alloc))
+      if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, with_alloc, parser,
+                   param))
         DBUG_RETURN(1);
   }
   DBUG_RETURN(0);
@@ -116,10 +120,12 @@
 FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, const byte *record)
 {
   TREE ptree;
+  MYSQL_FTPARSER_PARAM *param;
   DBUG_ENTER("_mi_ft_parserecord");
-
+  if (! (param= ftparser_call_initializer(info, keynr)))
+    DBUG_RETURN(NULL);
   bzero((char*) &ptree, sizeof(ptree));
-  if (_mi_ft_parse(&ptree, info, keynr, record,0))
+  if (_mi_ft_parse(&ptree, info, keynr, record, 0, param))
     DBUG_RETURN(NULL);
 
   DBUG_RETURN(ft_linearize(&ptree));

--- 1.297/sql/field.cc	2006-01-16 08:26:26 -05:00
+++ 1.298/sql/field.cc	2006-01-30 08:46:31 -05:00
@@ -1565,7 +1565,6 @@
 bool Field::quote_data(String *unquoted_string)
 {
   char escaped_string[IO_SIZE];
-  char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
   DBUG_ENTER("Field::quote_data");
 
   if (!needs_quotes())
@@ -4545,8 +4544,6 @@
       error= 1;
     }
   }
-  if (error > 1)
-    error= 2;
 
 #ifdef WORDS_BIGENDIAN
   if (table->s->db_low_byte_first)
@@ -5880,7 +5877,7 @@
                                                     field_length/
                                                     field_charset->mbmaxlen,
                                                     &well_formed_error);
-  memcpy(ptr,from,copy_length);
+  memmove(ptr, from, copy_length);
 
   /* Append spaces if the string was shorter than the field. */
   if (copy_length < field_length)
@@ -6296,7 +6293,7 @@
 						    field_length/
 						    field_charset->mbmaxlen,
                                                     &well_formed_error);
-  memcpy(ptr + length_bytes, from, copy_length);
+  memmove(ptr + length_bytes, from, copy_length);
   if (length_bytes == 1)
     *ptr= (uchar) copy_length;
   else
@@ -7113,7 +7110,7 @@
     }
     get_ptr(&blob);
     gobj= Geometry::construct(&buffer, blob, blob_length);
-    if (gobj->get_mbr(&mbr, &dummy))
+    if (!gobj || gobj->get_mbr(&mbr, &dummy))
       bzero(buff, SIZEOF_STORED_DOUBLE*4);
     else
     {
@@ -7442,7 +7439,7 @@
   }
   get_ptr(&blob);
   gobj= Geometry::construct(&buffer, blob, blob_length);
-  if (gobj->get_mbr(&mbr, &dummy))
+  if (!gobj || gobj->get_mbr(&mbr, &dummy))
     bzero(buff, SIZEOF_STORED_DOUBLE*4);
   else
   {
@@ -8239,16 +8236,14 @@
 */
 
 Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg,
-                                     uchar *null_ptr_arg, uchar null_bit_arg, 
-                                     uchar *bit_ptr_arg, uchar bit_ofs_arg, 
-                                     enum utype unireg_check_arg, 
-                                     const char *field_name_arg)
+                                     uchar *null_ptr_arg, uchar null_bit_arg,
+                                     enum utype unireg_check_arg,
+                                     const char *field_name_arg,
+                                     struct st_table *table_arg)
   :Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, bit_ptr_arg,
              bit_ofs_arg, unireg_check_arg, field_name_arg),
    create_length(len_arg)
 {
-  bit_ptr= 0;
-  bit_ofs= 0;
   bit_len= 0;
   field_length= ((len_arg + 7) & ~7) / 8;
 }

--- 1.174/sql/field.h	2006-01-09 05:35:25 -05:00
+++ 1.175/sql/field.h	2006-01-30 08:27:37 -05:00
@@ -1372,12 +1372,12 @@
   }
 };
 
-  
+
 class Field_bit_as_char: public Field_bit {
 public:
   uchar create_length;
   Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
-                    uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
+                    uchar null_bit_arg,
                     enum utype unireg_check_arg, const char *field_name_arg);
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
   uint32 max_length() { return (uint32) create_length; }

--- 1.170/sql/ha_myisam.cc	2006-01-19 16:40:51 -05:00
+++ 1.171/sql/ha_myisam.cc	2006-01-30 08:27:37 -05:00
@@ -285,7 +285,8 @@
 
   if (fd < 0)
   {
-    my_net_write(net, "", 0);
+    if (my_net_write(net, "", 0))
+      error = errno ? errno : EPIPE;
     net_flush(net);
   }
 
@@ -419,12 +420,14 @@
     {
       uint old_testflag=param.testflag;
       param.testflag|=T_MEDIUM;
-      init_io_cache(&param.read_cache, file->dfile,
-		    my_default_record_cache_size, READ_CACHE,
-		    share->pack.header_length, 1, MYF(MY_WME));
-      error |= chk_data_link(&param, file, param.testflag & T_EXTEND);
-      end_io_cache(&(param.read_cache));
-      param.testflag=old_testflag;
+      if (!(error= init_io_cache(&param.read_cache, file->dfile,
+                                 my_default_record_cache_size, READ_CACHE,
+                                 share->pack.header_length, 1, MYF(MY_WME))))
+      {
+        error= chk_data_link(&param, file, param.testflag & T_EXTEND);
+        end_io_cache(&(param.read_cache));
+      }
+      param.testflag= old_testflag;
     }
   }
   if (!error)

--- 1.164/sql/item.cc	2006-01-06 13:34:56 -05:00
+++ 1.165/sql/item.cc	2006-01-30 08:46:31 -05:00
@@ -985,7 +985,7 @@
 
 void Item_case_expr::print(String *str)
 {
-  str->append(STRING_WITH_LEN("case_expr@"));
+  VOID(str->append(STRING_WITH_LEN("case_expr@")));
   str->qs_append(m_case_expr_id);
 }
 
@@ -5257,6 +5257,7 @@
     setup_field()
       thd   - current thread context
       table - table of trigger (and where we looking for fields)
+      table_grant_info - GRANT_INFO of the subject table
 
   NOTE
     This function does almost the same as fix_fields() for Item_field
@@ -5270,7 +5271,8 @@
     table of trigger which uses this item.
 */
 
-void Item_trigger_field::setup_field(THD *thd, TABLE *table)
+void Item_trigger_field::setup_field(THD *thd, TABLE *table,
+                                     GRANT_INFO *table_grant_info)
 {
   bool save_set_query_id= thd->set_query_id;
 
@@ -5284,6 +5286,7 @@
                             0, &field_idx);
   thd->set_query_id= save_set_query_id;
   triggers= table->triggers;
+  table_grants= table_grant_info;
 }
 
 
@@ -5302,22 +5305,42 @@
     Since trigger is object tightly associated with TABLE object most
     of its set up can be performed during trigger loading i.e. trigger
     parsing! So we have little to do in fix_fields. :)
-    FIXME may be we still should bother about permissions here.
   */
+
   DBUG_ASSERT(fixed == 0);
 
+  /* Set field. */
+
   if (field_idx != (uint)-1)
   {
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+    /*
+      Check access privileges for the subject table. We check privileges only
+      in runtime.
+    */
+
+    if (table_grants)
+    {
+      table_grants->want_privilege=
+        access_type == AT_READ ? SELECT_ACL : UPDATE_ACL;
+
+      if (check_grant_column(thd, table_grants, triggers->table->s->db,
+                             triggers->table->s->table_name, field_name,
+                             strlen(field_name), thd->security_ctx))
+        return TRUE;
+    }
+#endif // NO_EMBEDDED_ACCESS_CHECKS
+
     field= (row_version == OLD_ROW) ? triggers->old_field[field_idx] :
                                       triggers->new_field[field_idx];
     set_field(field);
     fixed= 1;
-    return 0;
+    return FALSE;
   }
 
   my_error(ER_BAD_FIELD_ERROR, MYF(0), field_name,
            (row_version == NEW_ROW) ? "NEW" : "OLD");
-  return 1;
+  return TRUE;
 }
 
 

--- 1.189/sql/item.h	2006-01-20 11:38:06 -05:00
+++ 1.190/sql/item.h	2006-01-30 08:27:37 -05:00
@@ -2172,6 +2172,8 @@
   /* Is this item represents row from NEW or OLD row ? */
   enum row_version_type {OLD_ROW, NEW_ROW};
   row_version_type row_version;
+  /* Is this item used for reading or updating the value? */
+  enum access_types { AT_READ = 0x1, AT_UPDATE = 0x2 };
   /* Next in list of all Item_trigger_field's in trigger */
   Item_trigger_field *next_trg_field;
   /* Index of the field in the TABLE::field array */
@@ -2181,18 +2183,24 @@
 
   Item_trigger_field(Name_resolution_context *context_arg,
                      row_version_type row_ver_arg,
-                     const char *field_name_arg)
+                     const char *field_name_arg,
+                     access_types access_type_arg)
     :Item_field(context_arg,
                (const char *)NULL, (const char *)NULL, field_name_arg),
-     row_version(row_ver_arg), field_idx((uint)-1)
+     row_version(row_ver_arg), field_idx((uint)-1),
+     access_type(access_type_arg), table_grants(NULL)
   {}
-  void setup_field(THD *thd, TABLE *table);
+  void setup_field(THD *thd, TABLE *table, GRANT_INFO *table_grant_info);
   enum Type type() const { return TRIGGER_FIELD_ITEM; }
   bool eq(const Item *item, bool binary_cmp) const;
   bool fix_fields(THD *, Item **);
   void print(String *str);
   table_map used_tables() const { return (table_map)0L; }
   void cleanup();
+
+private:
+  access_types access_type;
+  GRANT_INFO *table_grants;
 };
 
 

--- 1.271/sql/item_func.cc	2005-12-12 14:55:12 -05:00
+++ 1.272/sql/item_func.cc	2006-01-30 08:46:31 -05:00
@@ -431,12 +431,19 @@
 
 void Item_func::fix_num_length_and_dec()
 {
-  decimals= 0;
+  uint fl_length= 0;
+  decimals=0;
   for (uint i=0 ; i < arg_count ; i++)
   {
-    set_if_bigger(decimals, args[i]->decimals);
+    set_if_bigger(decimals,args[i]->decimals);
+    set_if_bigger(fl_length, args[i]->max_length);
+  }
+  max_length=float_length(decimals);
+  if (fl_length > max_length)
+  {
+    decimals= NOT_FIXED_DEC;
+    max_length= float_length(NOT_FIXED_DEC);
   }
-  max_length= float_length(decimals);
 }
 
 
@@ -890,7 +897,7 @@
   my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf);
   if (null_value)
     return NULL;
-  my_decimal2string(E_DEC_FATAL_ERROR, &tmp_buf, 0, 0, 0, str);
+  my_decimal2string(E_DEC_FATAL_ERROR, tmp, 0, 0, 0, str);
   return str;
 }
 
@@ -4713,6 +4720,7 @@
   if (!dummy_table->alias)
   {
     char *empty_name= (char *) "";
+    dummy_table->s= share= &dummy_table->share_not_to_be_used;
     dummy_table->alias= empty_name;
     dummy_table->maybe_null= maybe_null;
     dummy_table->in_use= current_thd;
@@ -4746,8 +4754,13 @@
   
   if (!(f= *flp))
   {
-    *flp= f= sp_result_field();
-    f->move_field((f->pack_length() > sizeof(result_buf)) ? 
+    if (!(*flp= f= sp_result_field()))
+    {
+      my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+      return 0;
+    }
+
+    f->move_field((f->pack_length() > sizeof(result_buf)) ?
                   sql_alloc(f->pack_length()) : result_buf);
     f->null_ptr= (uchar *)&null_value;
     f->null_bit= 1;

--- 1.201/sql/log_event.cc	2006-01-25 22:54:37 -05:00
+++ 1.202/sql/log_event.cc	2006-01-30 08:27:37 -05:00
@@ -3342,6 +3342,10 @@
   case INSERT_ID_EVENT:
     msg="INSERT_ID";
     break;
+  case INVALID_INT_EVENT:
+  default: // cannot happen
+    msg="INVALID_INT";
+    break;
   }
   fprintf(file, "%s=%s;\n", msg, llstr(val,llbuff));
   fflush(file);

--- 1.126/client/mysqlbinlog.cc	2006-01-04 14:37:03 -05:00
+++ 1.127/client/mysqlbinlog.cc	2006-01-30 08:27:35 -05:00
@@ -1293,12 +1293,13 @@
       }
       else if (buf[4] == ROTATE_EVENT)
       {
+        Log_event *ev;
         my_b_seek(file, tmp_pos); /* seek back to event's start */
-        if (!Log_event::read_log_event(file, *description_event))
+        if (!(ev= Log_event::read_log_event(file, *description_event)))
           /* EOF can't be hit here normally, so it's a real error */
-          die("Could not read a Rotate_log_event event \
-at offset %lu ; this could be a log format error or read error",
-              tmp_pos);
+          die("Could not read a Rotate_log_event event at offset %lu ;"
+              " this could be a log format error or read error", tmp_pos);
+        delete ev;
       }
       else
         break;

--- 1.526/sql/mysqld.cc	2006-01-29 18:24:44 -05:00
+++ 1.527/sql/mysqld.cc	2006-01-30 08:27:38 -05:00
@@ -5118,9 +5118,9 @@
    (gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
    "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).",
-   (gptr*) &innobase_flush_log_at_trx_commit,
-   (gptr*) &innobase_flush_log_at_trx_commit,
-   0, GET_UINT, OPT_ARG,  1, 0, 2, 0, 0, 0},
+   (gptr*) &srv_flush_log_at_trx_commit,
+   (gptr*) &srv_flush_log_at_trx_commit,
+   0, GET_ULONG, OPT_ARG,  1, 0, 2, 0, 0, 0},
   {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
    "With which method to flush data.", (gptr*) &innobase_unix_file_flush_method,
    (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
@@ -5873,9 +5873,11 @@
    (gptr*) &srv_n_spin_wait_rounds,
    0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0},
   {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
-   "Helps in performance tuning in heavily concurrent environments.",
+   "Helps in performance tuning in heavily concurrent environments. "
+   "Sets the maximum number of threads allowed inside InnoDB. Value 0"
+   " will disable the thread throttling.",
    (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
-   0, GET_LONG, REQUIRED_ARG, 20, 1, 1000, 0, 1, 0},
+   0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},
   {"innodb_commit_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
    "Helps in performance tuning in heavily concurrent environments.",
    (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency,

--- 1.112/sql/protocol.cc	2006-01-04 05:18:54 -05:00
+++ 1.113/sql/protocol.cc	2006-01-30 08:27:38 -05:00
@@ -601,9 +601,23 @@
       else
       {
         /* With conversion */
+        uint max_char_len;
         int2store(pos, thd_charset->number);
-        uint char_len= field.length / item->collation.collation->mbmaxlen;
-        int4store(pos+2, char_len * thd_charset->mbmaxlen);
+        /*
+          For TEXT/BLOB columns, field_length describes the maximum data
+          length in bytes. There is no limit to the number of characters
+          that a TEXT column can store, as long as the data fits into
+          the designated space.
+          For the rest of textual columns, field_length is evaluated as
+          char_count * mbmaxlen, where character count is taken from the
+          definition of the column. In other words, the maximum number
+          of characters here is limited by the column definition.
+        */
+        max_char_len= (field.type >= (int) MYSQL_TYPE_TINY_BLOB &&
+                      field.type <= (int) MYSQL_TYPE_BLOB) ?
+                      field.length / item->collation.collation->mbminlen :
+                      field.length / item->collation.collation->mbmaxlen;
+        int4store(pos+2, max_char_len * thd_charset->mbmaxlen);
       }
       pos[6]= field.type;
       int2store(pos+7,field.flags);

--- 1.197/sql/opt_range.cc	2006-01-28 19:22:28 -05:00
+++ 1.198/sql/opt_range.cc	2006-01-30 08:27:38 -05:00
@@ -753,7 +753,6 @@
 			table_map read_tables, COND *conds,
                         bool allow_null_cond,
                         int *error)
-                        
 {
   SQL_SELECT *select;
   DBUG_ENTER("make_select");
@@ -7059,10 +7058,7 @@
   if (!quick)
     return 0;			/* no ranges found */
   if (quick->init())
-  {
-    delete quick;
     goto err;
-  }
   quick->records= records;
 
   if (cp_buffer_from_ref(thd,ref) && thd->is_fatal_error ||
@@ -8404,7 +8400,7 @@
   ha_rows cur_records;
   SEL_ARG *cur_index_tree= NULL;
   ha_rows cur_quick_prefix_records= 0;
-  uint cur_param_idx;
+  uint cur_param_idx=MAX_KEY;
   key_map cur_used_key_parts;
   uint pk= param->table->s->primary_key;
 
@@ -8620,6 +8616,7 @@
     */
     if (cur_read_cost < best_read_cost - (DBL_EPSILON * cur_read_cost))
     {
+      DBUG_ASSERT(tree != 0 || cur_param_idx == MAX_KEY);
       index_info= cur_index_info;
       index= cur_index;
       best_read_cost= cur_read_cost;

--- 1.59/sql/opt_range.h	2006-01-04 03:11:19 -05:00
+++ 1.60/sql/opt_range.h	2006-01-30 08:27:38 -05:00
@@ -706,7 +706,7 @@
 class FT_SELECT: public QUICK_RANGE_SELECT {
 public:
   FT_SELECT(THD *thd, TABLE *table, uint key) :
-      QUICK_RANGE_SELECT (thd, table, key, 1) { init(); }
+      QUICK_RANGE_SELECT (thd, table, key, 1) { VOID(init()); }
   ~FT_SELECT() { file->ft_end(); }
   int init() { return error=file->ft_init(); }
   int reset() { return 0; }

--- 1.262/sql/slave.cc	2006-01-18 21:56:00 -05:00
+++ 1.263/sql/slave.cc	2006-01-30 08:27:38 -05:00
@@ -1742,7 +1742,8 @@
                         " to the relay log, "
                         "SHOW SLAVE STATUS may be inaccurate");
       rli->relay_log.harvest_bytes_written(&rli->log_space_total);
-      flush_master_info(mi, 1);
+      if (flush_master_info(mi, 1))
+        sql_print_error("Failed to flush master info file");
       delete ev;
     }
     else
@@ -2233,7 +2234,7 @@
 
     pthread_mutex_unlock(&mi->rli.data_lock);
     pthread_mutex_unlock(&mi->data_lock);
-  
+
     if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
       DBUG_RETURN(TRUE);
   }
@@ -2241,8 +2242,13 @@
   DBUG_RETURN(FALSE);
 }
 
-
-bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
+/*
+  RETURN
+     2 - flush relay log failed
+     1 - flush master info failed
+     0 - all ok
+*/
+int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
 {
   IO_CACHE* file = &mi->file;
   char lbuf[22];
@@ -2261,8 +2267,9 @@
     When we come to this place in code, relay log may or not be initialized;
     the caller is responsible for setting 'flush_relay_log_cache' accordingly.
   */
-  if (flush_relay_log_cache)
-    flush_io_cache(mi->rli.relay_log.get_log_file());
+  if (flush_relay_log_cache &&
+      flush_io_cache(mi->rli.relay_log.get_log_file()))
+    DBUG_RETURN(2);
 
   /*
     We flushed the relay log BEFORE the master.info file, because if we crash
@@ -2274,13 +2281,13 @@
   */
 
   /*
-     In certain cases this code may create master.info files that seems 
-     corrupted, because of extra lines filled with garbage in the end 
-     file (this happens if new contents take less space than previous 
-     contents of file). But because of number of lines in the first line 
+     In certain cases this code may create master.info files that seems
+     corrupted, because of extra lines filled with garbage in the end
+     file (this happens if new contents take less space than previous
+     contents of file). But because of number of lines in the first line
      of file we don't care about this garbage.
   */
-  
+
   my_b_seek(file, 0L);
   my_b_printf(file, "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n",
 	      LINES_IN_MASTER_INFO_WITH_SSL,
@@ -2289,8 +2296,7 @@
 	      mi->password, mi->port, mi->connect_retry,
               (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
               mi->ssl_cipher, mi->ssl_key);
-  flush_io_cache(file);
-  DBUG_RETURN(0);
+  DBUG_RETURN(-flush_io_cache(file));
 }
 
 
@@ -3355,7 +3361,11 @@
 	sql_print_error("Slave I/O thread could not queue event from master");
 	goto err;
       }
-      flush_master_info(mi, 1); /* sure that we can flush the relay log */
+      if (flush_master_info(mi, 1))
+      {
+        sql_print_error("Failed to flush master info file");
+        goto err;
+      }
       /*
         See if the relay logs take too much space.
         We don't lock mi->rli.log_space_lock here; this dirty read saves time

--- 1.175/sql/sql_acl.cc	2006-01-13 11:04:32 -05:00
+++ 1.176/sql/sql_acl.cc	2006-01-30 08:27:38 -05:00
@@ -945,7 +945,7 @@
 
   DBUG_PRINT("enter", ("Host: '%s', Ip: '%s', User: '%s', db: '%s'",
                        (host ? host : "(NULL)"), (ip ? ip : "(NULL)"),
-                       (user ? user : "(NULL)"), (db ? db : "(NULL)")));
+                       user, (db ? db : "(NULL)")));
   sctx->user= user;
   sctx->host= host;
   sctx->ip= ip;
@@ -974,7 +974,7 @@
   for (i=0 ; i < acl_users.elements ; i++)
   {
     acl_user= dynamic_element(&acl_users,i,ACL_USER*);
-    if ((!acl_user->user && (!user || !user[0])) ||
+    if ((!acl_user->user && !user[0]) ||
 	(acl_user->user && strcmp(user, acl_user->user) == 0))
     {
       if (compare_hostname(&acl_user->host, host, ip))
@@ -995,7 +995,7 @@
       {
 	if (compare_hostname(&acl_db->host, host, ip))
 	{
-	  if (!acl_db->db || (db && !strcmp(acl_db->db, db)))
+	  if (!acl_db->db || (db && !wild_compare(db, acl_db->db, 0)))
 	  {
 	    sctx->db_access= acl_db->access;
 	    break;
@@ -4974,8 +4974,6 @@
     }
     if (! user)
       user= "";
-    if (! host)
-      host= "";
 #ifdef EXTRA_DEBUG
     DBUG_PRINT("loop",("scan struct: %u  index: %u  user: '%s'  host: '%s'",
                        struct_no, idx, user, host));

--- 1.125/sql/sql_db.cc	2006-01-18 21:56:00 -05:00
+++ 1.126/sql/sql_db.cc	2006-01-30 08:27:39 -05:00
@@ -287,7 +287,7 @@
 }
 
 
-/* 
+/*
   Load database options file
 
   load_db_opt()
@@ -313,68 +313,72 @@
 
   bzero((char*) create,sizeof(*create));
   create->default_table_charset= thd->variables.collation_server;
-  
+
   /* Check if options for this database are already in the hash */
   if (!get_dbopt(path, create))
-    DBUG_RETURN(0);	   
-  
+    DBUG_RETURN(0);
+
   /* Otherwise, load options from the .opt file */
-  if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
-  {
-    IO_CACHE cache;
-    init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0));
+  if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
+    goto err1;
+
+  IO_CACHE cache;
+  if (init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0)))
+    goto err2;
 
-    while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
+  while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
+  {
+    char *pos= buf+nbytes-1;
+    /* Remove end space and control characters */
+    while (pos > buf && !my_isgraph(&my_charset_latin1, pos[-1]))
+      pos--;
+    *pos=0;
+    if ((pos= strchr(buf, '=')))
     {
-      char *pos= buf+nbytes-1;
-      /* Remove end space and control characters */
-      while (pos > buf && !my_isgraph(&my_charset_latin1, pos[-1]))
-	pos--;
-      *pos=0;
-      if ((pos= strchr(buf, '=')))
+      if (!strncmp(buf,"default-character-set", (pos-buf)))
+      {
+        /*
+           Try character set name, and if it fails
+           try collation name, probably it's an old
+           4.1.0 db.opt file, which didn't have
+           separate default-character-set and
+           default-collation commands.
+        */
+        if (!(create->default_table_charset=
+        get_charset_by_csname(pos+1, MY_CS_PRIMARY, MYF(0))) &&
+            !(create->default_table_charset=
+              get_charset_by_name(pos+1, MYF(0))))
+        {
+          sql_print_error("Error while loading database options: '%s':",path);
+          sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
+          create->default_table_charset= default_charset_info;
+        }
+      }
+      else if (!strncmp(buf,"default-collation", (pos-buf)))
       {
-	if (!strncmp(buf,"default-character-set", (pos-buf)))
-	{
-          /*
-             Try character set name, and if it fails 
-             try collation name, probably it's an old
-             4.1.0 db.opt file, which didn't have
-             separate default-character-set and
-             default-collation commands.
-          */
-	  if (!(create->default_table_charset=
-		get_charset_by_csname(pos+1, MY_CS_PRIMARY, MYF(0))) &&
-              !(create->default_table_charset=
-                get_charset_by_name(pos+1, MYF(0))))
-	  {
-	    sql_print_error("Error while loading database options: '%s':",path);
-	    sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
-            create->default_table_charset= default_charset_info;
-	  }
-	}
-	else if (!strncmp(buf,"default-collation", (pos-buf)))
-	{
-	  if (!(create->default_table_charset= get_charset_by_name(pos+1,
-								   MYF(0))))
-	  {
-	    sql_print_error("Error while loading database options: '%s':",path);
-	    sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
-            create->default_table_charset= default_charset_info;
-	  }
-	}
+        if (!(create->default_table_charset= get_charset_by_name(pos+1,
+                                                           MYF(0))))
+        {
+          sql_print_error("Error while loading database options: '%s':",path);
+          sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
+          create->default_table_charset= default_charset_info;
+        }
       }
     }
-    end_io_cache(&cache);
-    my_close(file,MYF(0));
-    /*
-      Put the loaded value into the hash.
-      Note that another thread could've added the same
-      entry to the hash after we called get_dbopt(),
-      but it's not an error, as put_dbopt() takes this
-      possibility into account.
-    */
-    error= put_dbopt(path, create);
   }
+  /*
+    Put the loaded value into the hash.
+    Note that another thread could've added the same
+    entry to the hash after we called get_dbopt(),
+    but it's not an error, as put_dbopt() takes this
+    possibility into account.
+  */
+  error= put_dbopt(path, create);
+
+  end_io_cache(&cache);
+err2:
+  my_close(file,MYF(0));
+err1:
   DBUG_RETURN(error);
 }
 

--- 1.185/sql/sql_insert.cc	2006-01-11 03:16:19 -05:00
+++ 1.186/sql/sql_insert.cc	2006-01-30 08:46:31 -05:00
@@ -686,6 +686,8 @@
 
   DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
 
+  VOID(bitmap_init(&used_fields, used_fields_buff, used_fields_buff_size * 8,
+                   0));
   bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0);
   bitmap_clear_all(&used_fields);
 

--- 1.514/sql/sql_parse.cc	2006-01-28 13:21:13 -05:00
+++ 1.515/sql/sql_parse.cc	2006-01-30 08:27:39 -05:00
@@ -1615,6 +1615,11 @@
     statistic_increment(thd->status_var.com_other, &LOCK_status);
     thd->enable_slow_log= opt_log_slow_admin_statements;
     db= thd->alloc(db_len + tbl_len + 2);
+    if (!db)
+    {
+      my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+      break;
+    }
     tbl_name= strmake(db, packet + 1, db_len)+1;
     strmake(tbl_name, packet + db_len + 2, tbl_len);
     mysql_table_dump(thd, db, tbl_name, -1);
@@ -1628,14 +1633,14 @@
     statistic_increment(thd->status_var.com_other, &LOCK_status);
     char *user= (char*) packet;
     char *passwd= strend(user)+1;
-    /* 
+    /*
       Old clients send null-terminated string ('\0' for empty string) for
       password.  New clients send the size (1 byte) + string (not null
       terminated, so also '\0' for empty string).
     */
-    char db_buff[NAME_LEN+1];                 // buffer to store db in utf8 
+    char db_buff[NAME_LEN+1];                 // buffer to store db in utf8
     char *db= passwd;
-    uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? 
+    uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
       *passwd++ : strlen(passwd);
     db+= passwd_len + 1;
 #ifndef EMBEDDED_LIBRARY
@@ -2413,23 +2418,26 @@
     }
   }
   else
-#endif /* HAVE_REPLICATION */
-
-  /*
-    When option readonly is set deny operations which change non-temporary
-    tables. Except for the replication thread and the 'super' users.
-  */
-  if (opt_readonly &&
-      !(thd->security_ctx->master_access & SUPER_ACL) &&
-      uc_update_queries[lex->sql_command] &&
-      !((lex->sql_command == SQLCOM_CREATE_TABLE) &&
-        (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) &&
-      ((lex->sql_command != SQLCOM_UPDATE_MULTI) &&
-       some_non_temp_table_to_be_updated(thd, all_tables)))
   {
-    my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
-    DBUG_RETURN(-1);
-  }
+#endif /* HAVE_REPLICATION */
+    /*
+      When option readonly is set deny operations which change non-temporary
+      tables. Except for the replication thread and the 'super' users.
+    */
+    if (opt_readonly &&
+	!(thd->security_ctx->master_access & SUPER_ACL) &&
+	uc_update_queries[lex->sql_command] &&
+	!((lex->sql_command == SQLCOM_CREATE_TABLE) &&
+	  (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) &&
+	((lex->sql_command != SQLCOM_UPDATE_MULTI) &&
+	 some_non_temp_table_to_be_updated(thd, all_tables)))
+    {
+      my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
+      DBUG_RETURN(-1);
+    }
+#ifdef HAVE_REPLICATION
+  } /* endif unlikely slave */
+#endif
   if(lex->orig_sql_command == SQLCOM_END)
     statistic_increment(thd->status_var.com_stat[lex->sql_command],
                         &LOCK_status);
@@ -3221,8 +3229,7 @@
     else
       res= 0;
 
-    if ((res= mysql_multi_update_prepare(thd)))
-      break;
+    res= mysql_multi_update_prepare(thd);
 
 #ifdef HAVE_REPLICATION
     /* Check slave filtering rules */
@@ -3230,20 +3237,33 @@
     {
       if (all_tables_not_ok(thd, all_tables))
       {
+        if (res!= 0)
+        {
+          res= 0;             /* don't care of prev failure  */
+          thd->clear_error(); /* filters are of highest prior */
+        }
         /* we warn the slave SQL thread */
         my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
         break;
       }
+      if (res)
+        break;
     }
     else
-#endif /* HAVE_REPLICATION */
-    if (opt_readonly &&
-        !(thd->security_ctx->master_access & SUPER_ACL) &&
-        some_non_temp_table_to_be_updated(thd, all_tables))
     {
-      my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
-      break;
-    }
+#endif /* HAVE_REPLICATION */
+      if (res)
+        break;
+      if (opt_readonly &&
+	  !(thd->security_ctx->master_access & SUPER_ACL) &&
+	  some_non_temp_table_to_be_updated(thd, all_tables))
+      {
+	my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
+	break;
+      }
+#ifdef HAVE_REPLICATION
+    }  /* unlikely */
+#endif
 
     res= mysql_multi_update(thd, all_tables,
                             &select_lex->item_list,
@@ -6626,6 +6646,7 @@
 #ifdef HAVE_REPLICATION
   if (options & REFRESH_MASTER)
   {
+    DBUG_ASSERT(thd);
     tmp_write_to_binlog= 0;
     if (reset_master(thd))
     {

--- 1.383/sql/sql_select.cc	2006-01-26 08:36:23 -05:00
+++ 1.384/sql/sql_select.cc	2006-01-30 08:27:40 -05:00
@@ -2214,7 +2214,8 @@
 	  if (eq_part.is_prefix(table->key_info[key].key_parts) &&
 	      ((table->key_info[key].flags & (HA_NOSAME | HA_END_SPACE_KEY)) ==
 	       HA_NOSAME) &&
-              !table->fulltext_searched)
+              !table->fulltext_searched && 
+              !table->pos_in_table_list->embedding)
 	  {
 	    if (const_ref == eq_part)
 	    {					// Found everything for ref.
@@ -9117,7 +9118,7 @@
 
     field++;
   }
-  *field= NULL;                                 /* mark the end of the list */
+  *field= NULL;                             /* mark the end of the list */
   share->blob_field[blob_count]= 0;            /* mark the end of the list */
   share->blob_fields= blob_count;
 
@@ -11659,6 +11660,12 @@
 	goto err;
     }
   }
+
+  /* Fill schema tables with data before filesort if it's necessary */
+  if ((join->select_lex->options & OPTION_SCHEMA_TABLE) &&
+      get_schema_tables_result(join))
+    goto err;
+
   if (table->s->tmp_table)
     table->file->info(HA_STATUS_VARIABLE);	// Get record count
   table->sort.found_records=filesort(thd, table,sortorder, length,

--- 1.293/sql/sql_show.cc	2006-01-18 21:56:01 -05:00
+++ 1.294/sql/sql_show.cc	2006-01-30 08:27:40 -05:00
@@ -782,7 +782,7 @@
    it's a keyword
   */
 
-  packet->reserve(length*2 + 2);
+  VOID(packet->reserve(length*2 + 2));
   quote_char= (char) q;
   packet->append(&quote_char, 1, system_charset_info);
 
@@ -1098,13 +1098,13 @@
       if (key_part->field)
         append_identifier(thd,packet,key_part->field->field_name,
 			  strlen(key_part->field->field_name));
-      if (!key_part->field ||
+      if (key_part->field &&
           (key_part->length !=
            table->field[key_part->fieldnr-1]->key_length() &&
            !(key_info->flags & HA_FULLTEXT)))
       {
         buff[0] = '(';
-        char* end=int10_to_str((long) key_part->length / 
+        char* end=int10_to_str((long) key_part->length /
 			       key_part->field->charset()->mbmaxlen,
 			       buff + 1,10);
         *end++ = ')';
@@ -1844,7 +1844,8 @@
 {
   MEM_ROOT *mem= thd->mem_root;
   if (allocate_lex_string)
-    lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING));
+    if (!(lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING))))
+      return 0;
   lex_str->str= strmake_root(mem, str, length);
   lex_str->length= length;
   return lex_str;
@@ -3102,7 +3103,7 @@
       /*
         I.e. we are in SELECT FROM INFORMATION_SCHEMA.STATISTICS
         rather than in SHOW KEYS
-      */ 
+      */
       if (!tables->view)
         push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
                      thd->net.last_errno, thd->net.last_error);
@@ -3115,7 +3116,7 @@
   {
     TABLE *show_table= tables->table;
     KEY *key_info=show_table->key_info;
-    show_table->file->info(HA_STATUS_VARIABLE | 
+    show_table->file->info(HA_STATUS_VARIABLE |
                            HA_STATUS_NO_LOCK |
                            HA_STATUS_TIME);
     for (uint i=0 ; i < show_table->s->keys ; i++,key_info++)
@@ -3127,7 +3128,7 @@
         restore_record(table, s->default_values);
         table->field[1]->store(base_name, strlen(base_name), cs);
         table->field[2]->store(file_name, strlen(file_name), cs);
-        table->field[3]->store((longlong) ((key_info->flags & 
+        table->field[3]->store((longlong) ((key_info->flags &
                                             HA_NOSAME) ? 0 : 1), TRUE);
         table->field[4]->store(base_name, strlen(base_name), cs);
         table->field[5]->store(key_info->name, strlen(key_info->name), cs);
@@ -3150,12 +3151,12 @@
           table->field[9]->store((longlong) records, TRUE);
           table->field[9]->set_notnull();
         }
-        if (!(key_info->flags & HA_FULLTEXT) && 
-            (!key_part->field ||
-             key_part->length != 
+        if (!(key_info->flags & HA_FULLTEXT) &&
+            (key_part->field &&
+             key_part->length !=
              show_table->field[key_part->fieldnr-1]->key_length()))
         {
-          table->field[10]->store((longlong) key_part->length / 
+          table->field[10]->store((longlong) key_part->length /
                                   key_part->field->charset()->mbmaxlen);
           table->field[10]->set_notnull();
         }
@@ -4273,7 +4274,16 @@
     TABLE_LIST *table_list= tab->table->pos_in_table_list;
     if (table_list->schema_table && thd->fill_derived_tables())
     {
-      if (&lex->unit != lex->current_select->master_unit()) // is subselect
+      bool is_subselect= (&lex->unit != lex->current_select->master_unit());
+      /*
+        The schema table is already processed and 
+        the statement is not a subselect.
+        So we don't need to handle this table again.
+      */
+      if (table_list->is_schema_table_processed && !is_subselect)
+        continue;
+
+      if (is_subselect) // is subselect
       {
         table_list->table->file->extra(HA_EXTRA_RESET_STATE);
         table_list->table->file->delete_all_rows();
@@ -4286,6 +4296,7 @@
       if (table_list->schema_table->fill_table(thd, table_list,
                                                tab->select_cond))
         result= 1;
+      table_list->is_schema_table_processed= TRUE;
     }
   }
   thd->no_warnings_for_error= 0;
@@ -4683,12 +4694,12 @@
     fill_schema_table_privileges, 0, 0, -1, -1, 0},
   {"TRIGGERS", triggers_fields_info, create_schema_table,
    get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0},
+  {"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table, 
+    fill_schema_user_privileges, 0, 0, -1, -1, 0},
   {"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
    make_old_format, 0, -1, -1, 1},
   {"VIEWS", view_fields_info, create_schema_table, 
     get_all_tables, 0, get_schema_views_record, 1, 2, 0},
-  {"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table, 
-    fill_schema_user_privileges, 0, 0, -1, -1, 0},
   {0, 0, 0, 0, 0, 0, 0, 0, 0}
 };
 

--- 1.44/sql/sql_test.cc	2005-11-23 15:44:57 -05:00
+++ 1.45/sql/sql_test.cc	2006-01-30 08:27:40 -05:00
@@ -450,7 +450,7 @@
 
   calc_sum_of_all_status(&tmp);
   printf("\nStatus information:\n\n");
-  my_getwd(current_dir, sizeof(current_dir),MYF(0));
+  VOID(my_getwd(current_dir, sizeof(current_dir),MYF(0)));
   printf("Current dir: %s\n", current_dir);
   printf("Running threads: %d  Stack size: %ld\n", thread_count,
 	 (long) thread_stack);

--- 1.446/sql/sql_yacc.yy	2006-01-26 19:07:28 -05:00
+++ 1.447/sql/sql_yacc.yy	2006-01-30 08:46:31 -05:00
@@ -1640,11 +1640,26 @@
 sp_name:
 	  ident '.' ident
 	  {
+            if (!$1.str || check_db_name($1.str))
+            {
+	      my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
+	      YYABORT;
+	    }
+	    if (check_routine_name($3))
+            {
+	      my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
+	      YYABORT;
+	    }
 	    $$= new sp_name($1, $3);
 	    $$->init_qname(YYTHD);
 	  }
 	| ident
 	  {
+	    if (check_routine_name($1))
+            {
+	      my_error(ER_SP_WRONG_NAME, MYF(0), $1.str);
+	      YYABORT;
+	    }
 	    $$= sp_name_current_db_new(YYTHD, $1);
 	  }
 	;
@@ -2358,19 +2373,28 @@
 	    }
 	    sp->restore_lex(YYTHD);
 	  }
+        | IF
+          { Lex->sphead->new_cont_backpatch(NULL); }
+          sp_if END IF
+          { Lex->sphead->do_cont_backpatch(); }
+	| CASE_SYM WHEN_SYM
         ;
 
 sp_proc_stmt_case_simple:
 	CASE_SYM WHEN_SYM
 	  {
 	    Lex->sphead->m_flags&= ~sp_head::IN_SIMPLE_CASE;
+            Lex->sphead->new_cont_backpatch(NULL);
 	  }
-	  sp_case END CASE_SYM {}
+          sp_case END CASE_SYM { Lex->sphead->do_cont_backpatch(); }
         ;
         
 sp_proc_stmt_case:
           CASE_SYM
-          { Lex->sphead->reset_lex(YYTHD); }
+          {
+            Lex->sphead->reset_lex(YYTHD);
+            Lex->sphead->new_cont_backpatch(NULL);
+          }
           expr WHEN_SYM
 	  {
 	    LEX *lex= Lex;
@@ -2394,6 +2418,7 @@
 	  sp_case END CASE_SYM
 	  {
 	    Lex->spcont->pop_case_expr_id();
+            Lex->sphead->do_cont_backpatch();
 	  }
         ;
 
@@ -2684,6 +2709,7 @@
                                                                $2, lex);
 
 	    sp->push_backpatch(i, ctx->push_label((char *)"", 0));
+            sp->add_cont_backpatch(i);
             sp->add_instr(i);
             sp->restore_lex(YYTHD);
 	  }
@@ -2742,6 +2768,7 @@
 	      i= new sp_instr_jump_if_not(ip, ctx, expr, lex);
 	    }
 	    sp->push_backpatch(i, ctx->push_label((char *)"", 0));
+            sp->add_cont_backpatch(i);
             sp->add_instr(i);
             sp->restore_lex(YYTHD);
 	  }
@@ -2871,6 +2898,7 @@
 
 	    /* Jumping forward */
 	    sp->push_backpatch(i, lex->spcont->last_label());
+            sp->new_cont_backpatch(i);
             sp->add_instr(i);
             sp->restore_lex(YYTHD);
 	  }
@@ -2882,6 +2910,7 @@
 	    sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
 
 	    lex->sphead->add_instr(i);
+            lex->sphead->do_cont_backpatch();
 	  }
         | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM 
           { Lex->sphead->reset_lex(YYTHD); }
@@ -2895,6 +2924,8 @@
                                                                lex);
             lex->sphead->add_instr(i);
             lex->sphead->restore_lex(YYTHD);
+            /* We can shortcut the cont_backpatch here */
+            i->m_cont_dest= ip+1;
 	  }
 	;
 
@@ -8996,7 +9027,8 @@
                                                   new_row ?
                                                   Item_trigger_field::NEW_ROW:
                                                   Item_trigger_field::OLD_ROW,
-                                                  $3.str)))
+                                                  $3.str,
+                                                  Item_trigger_field::AT_READ)))
               YYABORT;
 
             /*
@@ -9680,7 +9712,9 @@
 
             if (!(trg_fld= new Item_trigger_field(Lex->current_context(),
                                                   Item_trigger_field::NEW_ROW,
-                                                  $2.base_name.str)) ||
+                                                  $2.base_name.str,
+                                                  Item_trigger_field::AT_UPDATE)
+                                                  ) ||
                 !(sp_fld= new sp_instr_set_trigger_field(lex->sphead->
                           	                         instructions(),
                                 	                 lex->spcont,

--- 1.204/sql/table.cc	2006-01-24 11:46:07 -05:00
+++ 1.205/sql/table.cc	2006-01-30 08:27:41 -05:00
@@ -1640,7 +1640,10 @@
     ret_value=uint4korr(pos);
   }
   if (! save_names)
-    my_free((gptr) buf,MYF(0));
+  {
+    if (names)
+      my_free((gptr) buf,MYF(0));
+  }
   else if (!names)
     bzero((char*) save_names,sizeof(save_names));
   else

--- 1.125/sql/table.h	2006-01-18 21:56:01 -05:00
+++ 1.126/sql/table.h	2006-01-30 08:27:41 -05:00
@@ -352,9 +352,9 @@
   SCH_TABLE_NAMES,
   SCH_TABLE_PRIVILEGES,
   SCH_TRIGGERS,
+  SCH_USER_PRIVILEGES,
   SCH_VARIABLES,
-  SCH_VIEWS,
-  SCH_USER_PRIVILEGES
+  SCH_VIEWS
 };
 
 
@@ -558,6 +558,7 @@
   st_select_lex_unit *derived;		/* SELECT_LEX_UNIT of derived table */
   ST_SCHEMA_TABLE *schema_table;        /* Information_schema table */
   st_select_lex	*schema_select_lex;
+  bool is_schema_table_processed;
   /*
     True when the view field translation table is used to convert
     schema table fields for backwards compatibility with SHOW command.

--- 1.77/sql/share/errmsg.txt	2006-01-26 19:07:29 -05:00
+++ 1.78/sql/share/errmsg.txt	2006-01-30 08:46:31 -05:00
@@ -3006,7 +3006,7 @@
 	dan "Kan ikke finde funktionen '%-.64s' i bibliotek"
 	nla "Kan functie '%-.64s' niet in library vinden"
-	eng "Can't find symbol '%-.64s' in library"
+	eng "Can't find function '%-.64s' in library"
 	est "Ei leia funktsiooni '%-.64s' antud teegis"
@@ -3018,7 +3018,7 @@
 	rum "Nu pot gasi functia '%-.64s' in libraria"
 	serbian "Ne mogu da pronadjem funkciju '%-.64s' u biblioteci"
@@ -4898,7 +4898,7 @@
 	por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld"
 ER_WARN_DATA_OUT_OF_RANGE 22003 
-	eng "Out of range value for column '%s' at row %ld"
+	eng "Out of range value adjusted for column '%s' at row %ld"
 WARN_DATA_TRUNCATED 01000 
 	eng "Data truncated for column '%s' at row %ld"
@@ -5172,8 +5172,8 @@
 	eng "Incorrect number of FETCH variables"
 	ger "Falsche Anzahl von FETCH-Variablen"
 ER_SP_FETCH_NO_DATA 02000 
-	eng "No data to FETCH"
-	ger "Keine Daten mit FETCH abzuholen"
+	eng "No data - zero rows fetched, selected, or processed"
 ER_SP_DUP_PARAM 42000 
 	eng "Duplicate parameter: %s"
 	ger "Doppelter Parameter: %s"
@@ -5190,8 +5190,8 @@
 	eng "Failed to ALTER %s %s"
 	ger "ALTER %s %s fehlgeschlagen"
 ER_SP_SUBSELECT_NYI 0A000 
-	eng "Subquery value not supported"
+	eng "Subselect value not supported"
 ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 0A000
         eng "%s is not allowed in stored function or trigger"
 	ger "%s ist in gespeicherten Funktionen und in Triggern nicht erlaubt"
@@ -5589,7 +5589,7 @@
 	eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)"
 ER_SP_BAD_VAR_SHADOW 42000
-        eng "Variable '%-.64s' must be quoted with `...`, or renamed"
+	eng "Variable '%-.64s' must be quoted with `...`, or renamed"
 ER_TRG_NO_DEFINER
         eng "No definer attribute for trigger '%-.64s'.'%-.64s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger."
@@ -5601,6 +5601,9 @@
         eng "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.64s"
 ER_SP_PROC_TABLE_CORRUPT
+	eng "Failed to load routine %s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)"
+ER_SP_WRONG_NAME 42000
+	eng "Incorrect routine name '%-.64s'"
 	eng "Failed to load routine %-.64s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)"
 ER_PARTITION_REQUIRES_VALUES_ERROR
         eng "%-.64s PARTITIONING requires definition of VALUES %-.64s for each partition"

--- 1.3/mysql-test/t/trigger-grant.test	2005-12-14 15:39:15 -05:00
+++ 1.4/mysql-test/t/trigger-grant.test	2006-01-30 08:27:36 -05:00
@@ -8,8 +8,6 @@
 #
 # Tests for WL#2818:
 #   - Check that triggers are executed under the authorization of the definer.
-#   - Check that if trigger contains NEW/OLD variables, the definer must have
-#     SELECT privilege on the subject table.
 #   - Check DEFINER clause of CREATE TRIGGER statement;
 #     - Check that SUPER privilege required to create a trigger with different
 #       definer.
@@ -18,6 +16,8 @@
 #     - Check that the definer of a trigger does not exist, the trigger will
 #       not be activated.
 #   - Check that SHOW TRIGGERS statement provides "Definer" column.
+#   - Check that if trigger contains NEW/OLD variables, the definer must have
+#     SELECT privilege on the subject table (aka BUG#15166/BUG#15196).
 #
 #  Let's also check that user name part of definer can contain '@' symbol (to
 #  check that triggers are not affected by BUG#13310 "incorrect user parsing
@@ -143,28 +143,28 @@
 SELECT * FROM t2;
 
 #
-# Check that if trigger contains NEW/OLD variables, the definer must have
-# SELECT/UPDATE privilege on the subject table:
-#   - drop the trigger;
-#   - create a new trigger, which will use NEW variable;
-#   - create another new trigger, which will use OLD variable;
-#   - revoke SELECT/UPDATE privilege on the first table from "definer";
-#   - insert a row into the first table;
-#   - analyze error code;
+# Check DEFINER clause of CREATE TRIGGER statement.
 #
-
+# NOTE: there is no dedicated TRIGGER privilege for CREATE TRIGGER statement.
+# SUPER privilege is used instead. I.e., if one invokes CREATE TRIGGER, it should
+# have SUPER privilege, so this test is meaningless right now.
 #
-# SELECT privilege.
+#   - Check that SUPER privilege required to create a trigger with different
+#     definer:
+#     - try to create a trigger with DEFINER="definer@localhost" under
+#       "invoker";
+#     - analyze error code;
+#   - Check that if the user specified as DEFINER does not exist, a warning is
+#     emitted:
+#     - create a trigger with DEFINER="non_existent_user@localhost" from
+#       "definer";
+#     - check that a warning emitted;
+#   - Check that the definer of a trigger does not exist, the trigger will not
+#     be activated:
+#     - activate just created trigger;
+#     - check error code;
 #
 
---connection default
---echo
---echo ---> connection: default
-
-use mysqltest_db1;
-
-REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
-
 --connection wl2818_definer_con
 --echo
 --echo ---> connection: wl2818_definer_con
@@ -173,303 +173,394 @@
 
 DROP TRIGGER trg1;
 
-SET @new_sum = 0;
-SET @old_sum = 0;
-
-# INSERT INTO statement; BEFORE timing
-
---echo ---> INSERT INTO statement; BEFORE timing
+# Check that SUPER is required to specify different DEFINER.
+# NOTE: meaningless at the moment
 
-CREATE TRIGGER trg1 BEFORE INSERT ON t1
+CREATE DEFINER='mysqltest_inv'@'localhost'
+  TRIGGER trg1 BEFORE INSERT ON t1
   FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(4);
+    SET @new_sum = 0;
 
-# INSERT INTO statement; AFTER timing
+# Create with non-existent user.
 
---echo ---> INSERT INTO statement; AFTER timing
+CREATE DEFINER='mysqltest_nonexs'@'localhost'
+  TRIGGER trg2 AFTER INSERT ON t1
+  FOR EACH ROW
+    SET @new_sum = 0;
 
-DROP TRIGGER trg1;
+# Check that trg2 will not be activated.
 
-CREATE TRIGGER trg1 AFTER INSERT ON t1
-  FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+INSERT INTO t1 VALUES(6);
 
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(5);
+#
+# Check that SHOW TRIGGERS statement provides "Definer" column.
+#
 
-# UPDATE statement; BEFORE timing
+SHOW TRIGGERS;
 
---echo ---> UPDATE statement; BEFORE timing
+#
+# Check that weird definer values do not break functionality. I.e. check the
+# following definer values:
+#   - '';
+#   - '@';
+#   - '@abc@def@@';
+#   - '@hostname';
+#   - '@abc@def@@@hostname';
+#
 
 DROP TRIGGER trg1;
+DROP TRIGGER trg2;
 
-CREATE TRIGGER trg1 BEFORE UPDATE ON t1
+CREATE TRIGGER trg1 BEFORE INSERT ON t1
   FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 10;
-
-# UPDATE statement; AFTER timing
-
---echo ---> UPDATE statement; AFTER timing
+    SET @a = 1;
 
-DROP TRIGGER trg1;
+CREATE TRIGGER trg2 AFTER INSERT ON t1
+  FOR EACH ROW
+    SET @a = 2;
 
-CREATE TRIGGER trg1 AFTER UPDATE ON t1
+CREATE TRIGGER trg3 BEFORE UPDATE ON t1
   FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+    SET @a = 3;
 
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 20;
+CREATE TRIGGER trg4 AFTER UPDATE ON t1
+  FOR EACH ROW
+    SET @a = 4;
 
-# DELETE statement; BEFORE timing
+CREATE TRIGGER trg5 BEFORE DELETE ON t1
+  FOR EACH ROW
+    SET @a = 5;
 
---echo ---> DELETE statement; BEFORE timing
+--exec egrep -v '^definers=' $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG > $MYSQL_TEST_DIR/var/tmp/t1.TRG
+--exec echo "definers='' '@' '@abc@def@@' '@hostname' '@abcdef@@@hostname'" >> $MYSQL_TEST_DIR/var/tmp/t1.TRG
+--exec mv $MYSQL_TEST_DIR/var/tmp/t1.TRG $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG
 
-DROP TRIGGER trg1;
+--echo
 
-CREATE TRIGGER trg1 BEFORE DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
 
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+--echo
 
-# DELETE statement; AFTER timing
+SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
 
---echo ---> DELETE statement; AFTER timing
+#
+# Cleanup
+#
 
-DROP TRIGGER trg1;
+--connection default
+--echo
+--echo ---> connection: default
 
-CREATE TRIGGER trg1 AFTER DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+DROP USER mysqltest_dfn@localhost;
+DROP USER mysqltest_inv@localhost;
 
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+DROP DATABASE mysqltest_db1;
 
+###########################################################################
 #
-# UPDATE privilege
+# BUG#15166: Wrong update [was: select/update] permissions required to execute
+# triggers.
 #
-# NOTE: At the moment, UPDATE privilege is required if the trigger contains
-# NEW/OLD variables, whenever the trigger modifies them or not. Moreover,
-# UPDATE privilege is checked for whole table, not for individual columns.
+# BUG#15196: Wrong select permission required to execute triggers.
 #
-# The following test cases should be changed when full support of UPDATE
-# privilege will be done.
+###########################################################################
+
+#
+# Prepare environment.
 #
 
+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;
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_db1;
+--enable_warnings
+
+CREATE DATABASE mysqltest_db1;
+
+use mysqltest_db1;
+
+# Tables for tesing table-level privileges:
+CREATE TABLE t1(col CHAR(20)); # table for "read-value" trigger
+CREATE TABLE t2(col CHAR(20)); # table for "write-value" trigger
+
+# Tables for tesing column-level privileges:
+CREATE TABLE t3(col CHAR(20)); # table for "read-value" trigger
+CREATE TABLE t4(col CHAR(20)); # table for "write-value" trigger
+
+CREATE USER mysqltest_u1@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
+GRANT SUPER ON *.* TO mysqltest_u1@localhost;
+GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost; # to allow connect
+
+SET @mysqltest_var = NULL;
+
+--connect (bug15166_u1_con,localhost,mysqltest_u1,,mysqltest_db1)
+
+# parsing (CREATE TRIGGER) time:
+#   - check that nor SELECT either UPDATE is required to execute triggger w/o
+#     NEW/OLD variables.
+
 --connection default
 --echo
 --echo ---> connection: default
 
 use mysqltest_db1;
 
-GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
+REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
+GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
+SHOW GRANTS FOR mysqltest_u1@localhost;
 
---connection wl2818_definer_con
+--connection bug15166_u1_con
 --echo
---echo ---> connection: wl2818_definer_con
+--echo ---> connection: bug15166_u1_con
 
 use mysqltest_db1;
 
-DROP TRIGGER trg1;
+CREATE TRIGGER t1_trg_after_delete AFTER DELETE ON t1
+  FOR EACH ROW
+    SET @mysqltest_var = 'Hello, world!';
 
-SET @new_sum = 0;
-SET @old_sum = 0;
+# parsing (CREATE TRIGGER) time:
+#   - check that UPDATE is not enough to read the value;
+#   - check that UPDATE is required to modify the value;
 
-# INSERT INTO statement; BEFORE timing
+--connection default
+--echo
+--echo ---> connection: default
 
---echo ---> INSERT INTO statement; BEFORE timing
+use mysqltest_db1;
 
-CREATE TRIGGER trg1 BEFORE INSERT ON t1
-  FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
+GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
 
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(4);
+GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
+GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
 
-# INSERT INTO statement; AFTER timing
+--connection bug15166_u1_con
+--echo
+--echo ---> connection: bug15166_u1_con
 
---echo ---> INSERT INTO statement; AFTER timing
+use mysqltest_db1;
 
-DROP TRIGGER trg1;
+# - table-level privileges
 
-CREATE TRIGGER trg1 AFTER INSERT ON t1
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t1_trg_err_1 BEFORE INSERT ON t1
   FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+    SET @mysqltest_var = NEW.col;
+DROP TRIGGER t1_trg_err_1;
 
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(5);
-
-# UPDATE statement; BEFORE timing
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t1_trg_err_2 BEFORE DELETE ON t1
+  FOR EACH ROW
+    SET @mysqltest_var = OLD.col;
+DROP TRIGGER t1_trg_err_2;
 
---echo ---> UPDATE statement; BEFORE timing
+CREATE TRIGGER t2_trg_before_insert BEFORE INSERT ON t2
+  FOR EACH ROW
+    SET NEW.col = 't2_trg_before_insert';
 
-DROP TRIGGER trg1;
+# - column-level privileges
 
-CREATE TRIGGER trg1 BEFORE UPDATE ON t1
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t3_trg_err_1 BEFORE INSERT ON t3
   FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+    SET @mysqltest_var = NEW.col;
+DROP TRIGGER t3_trg_err_1;
 
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 10;
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t3_trg_err_2 BEFORE DELETE ON t3
+  FOR EACH ROW
+    SET @mysqltest_var = OLD.col;
+DROP TRIGGER t3_trg_err_2;
 
-# UPDATE statement; AFTER timing
+CREATE TRIGGER t4_trg_before_insert BEFORE INSERT ON t4
+  FOR EACH ROW
+    SET NEW.col = 't4_trg_before_insert';
 
---echo ---> UPDATE statement; AFTER timing
+# parsing (CREATE TRIGGER) time:
+#   - check that SELECT is required to read the value;
+#   - check that SELECT is not enough to modify the value;
 
-DROP TRIGGER trg1;
+--connection default
+--echo
+--echo ---> connection: default
 
-CREATE TRIGGER trg1 AFTER UPDATE ON t1
-  FOR EACH ROW
-    SET @new_sum = @new_sum + NEW.num_value;
+use mysqltest_db1;
 
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET num_value = 20;
+REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
+REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
+GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
+GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
+
+REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
+REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
+GRANT SELECT(col) on mysqltest_db1.t3 TO mysqltest_u1@localhost;
+GRANT SELECT(col) on mysqltest_db1.t4 TO mysqltest_u1@localhost;
 
-# DELETE statement; BEFORE timing
+--connection bug15166_u1_con
+--echo
+--echo ---> connection: bug15166_u1_con
 
---echo ---> DELETE statement; BEFORE timing
+use mysqltest_db1;
 
-DROP TRIGGER trg1;
+# - table-level privileges
 
-CREATE TRIGGER trg1 BEFORE DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+CREATE TRIGGER t1_trg_after_insert AFTER INSERT ON t1
+ FOR EACH ROW
+  SET @mysqltest_var = NEW.col;
+
+CREATE TRIGGER t1_trg_after_update AFTER UPDATE ON t1
+ FOR EACH ROW
+  SET @mysqltest_var = OLD.col;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t2_trg_err_1 BEFORE UPDATE ON t2
+ FOR EACH ROW
+  SET NEW.col = 't2_trg_err_1';
+DROP TRIGGER t2_trg_err_1;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t2_trg_err_2 BEFORE UPDATE ON t2
+ FOR EACH ROW
+  SET NEW.col = CONCAT(OLD.col, '(updated)');
+DROP TRIGGER t2_trg_err_2;
+
+# - column-level privileges
+
+CREATE TRIGGER t3_trg_after_insert AFTER INSERT ON t3
+  FOR EACH ROW
+    SET @mysqltest_var = NEW.col;
+
+CREATE TRIGGER t3_trg_after_update AFTER UPDATE ON t3
+  FOR EACH ROW
+    SET @mysqltest_var = OLD.col;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t4_trg_err_1 BEFORE UPDATE ON t4
+ FOR EACH ROW
+  SET NEW.col = 't4_trg_err_1';
+DROP TRIGGER t4_trg_err_1;
+
+# TODO: check privileges at CREATE TRIGGER time.
+# --error ER_COLUMNACCESS_DENIED_ERROR
+CREATE TRIGGER t4_trg_err_2 BEFORE UPDATE ON t4
+ FOR EACH ROW
+  SET NEW.col = CONCAT(OLD.col, '(updated)');
+DROP TRIGGER t4_trg_err_2;
+
+# execution time:
+#   - check that UPDATE is not enough to read the value;
+#   - check that UPDATE is required to modify the value;
 
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+--connection default
+--echo
+--echo ---> connection: default
 
-# DELETE statement; AFTER timing
+use mysqltest_db1;
 
---echo ---> DELETE statement; AFTER timing
+REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
+REVOKE SELECT ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
+GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
+GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
+
+REVOKE SELECT(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
+REVOKE SELECT(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
+GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
+GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
 
-DROP TRIGGER trg1;
+# - table-level privileges
 
-CREATE TRIGGER trg1 AFTER DELETE ON t1
-  FOR EACH ROW
-    SET @old_sum = @old_sum + OLD.num_value;
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t1 VALUES('line1');
 
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
+SELECT * FROM t1;
+SELECT @mysqltest_var;
 
-#
-# Check DEFINER clause of CREATE TRIGGER statement.
-#
-# NOTE: there is no dedicated TRIGGER privilege for CREATE TRIGGER statement.
-# SUPER privilege is used instead. I.e., if one invokes CREATE TRIGGER, it should
-# have SUPER privilege, so this test is meaningless right now.
-#
-#   - Check that SUPER privilege required to create a trigger with different
-#     definer:
-#     - try to create a trigger with DEFINER="definer@localhost" under
-#       "invoker";
-#     - analyze error code;
-#   - Check that if the user specified as DEFINER does not exist, a warning is
-#     emitted:
-#     - create a trigger with DEFINER="non_existent_user@localhost" from
-#       "definer";
-#     - check that a warning emitted;
-#   - Check that the definer of a trigger does not exist, the trigger will not
-#     be activated:
-#     - activate just created trigger;
-#     - check error code;
-#
+INSERT INTO t2 VALUES('line2');
 
---connection wl2818_definer_con
---echo
---echo ---> connection: wl2818_definer_con
+SELECT * FROM t2;
 
-use mysqltest_db1;
+# - column-level privileges
 
-DROP TRIGGER trg1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t3 VALUES('t3_line1');
 
-# Check that SUPER is required to specify different DEFINER.
-# NOTE: meaningless at the moment
+SELECT * FROM t3;
+SELECT @mysqltest_var;
 
-CREATE DEFINER='mysqltest_inv'@'localhost'
-  TRIGGER trg1 BEFORE INSERT ON t1
-  FOR EACH ROW
-    SET @new_sum = 0;
+INSERT INTO t4 VALUES('t4_line2');
 
-# Create with non-existent user.
+SELECT * FROM t4;
 
-CREATE DEFINER='mysqltest_nonexs'@'localhost'
-  TRIGGER trg2 AFTER INSERT ON t1
-  FOR EACH ROW
-    SET @new_sum = 0;
+# execution time:
+#   - check that SELECT is required to read the value;
+#   - check that SELECT is not enough to modify the value;
 
-# Check that trg2 will not be activated.
+--connection default
+--echo
+--echo ---> connection: default
 
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(6);
+use mysqltest_db1;
 
-#
-# Check that SHOW TRIGGERS statement provides "Definer" column.
-#
+REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
+REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
+GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
+GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
+
+REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
+REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
+GRANT SELECT(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
+GRANT SELECT(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
 
-SHOW TRIGGERS;
+# - table-level privileges
 
-#
-# Check that weird definer values do not break functionality. I.e. check the
-# following definer values:
-#   - '';
-#   - '@';
-#   - '@abc@def@@';
-#   - '@hostname';
-#   - '@abc@def@@@hostname';
-#
+INSERT INTO t1 VALUES('line3');
 
-DROP TRIGGER trg1;
-DROP TRIGGER trg2;
+SELECT * FROM t1;
+SELECT @mysqltest_var;
 
-CREATE TRIGGER trg1 BEFORE INSERT ON t1
-  FOR EACH ROW
-    SET @a = 1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t2 VALUES('line4');
 
-CREATE TRIGGER trg2 AFTER INSERT ON t1
-  FOR EACH ROW
-    SET @a = 2;
+SELECT * FROM t2;
 
-CREATE TRIGGER trg3 BEFORE UPDATE ON t1
-  FOR EACH ROW
-    SET @a = 3;
+# - column-level privileges
 
-CREATE TRIGGER trg4 AFTER UPDATE ON t1
-  FOR EACH ROW
-    SET @a = 4;
+INSERT INTO t3 VALUES('t3_line2');
 
-CREATE TRIGGER trg5 BEFORE DELETE ON t1
-  FOR EACH ROW
-    SET @a = 5;
+SELECT * FROM t3;
+SELECT @mysqltest_var;
 
---exec egrep -v '^definers=' $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG > $MYSQL_TEST_DIR/var/tmp/t1.TRG
---exec echo "definers='' '@' '@abc@def@@' '@hostname' '@abcdef@@@hostname'" >> $MYSQL_TEST_DIR/var/tmp/t1.TRG
---exec mv $MYSQL_TEST_DIR/var/tmp/t1.TRG $MYSQL_TEST_DIR/var/master-data/mysqltest_db1/t1.TRG
+--error ER_COLUMNACCESS_DENIED_ERROR
+INSERT INTO t4 VALUES('t4_line2');
 
---echo
+SELECT * FROM t4;
 
-SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
+# execution time:
+#   - check that nor SELECT either UPDATE is required to execute triggger w/o
+#     NEW/OLD variables.
 
---echo
+DELETE FROM t1;
 
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
+SELECT @mysqltest_var;
 
 #
-# Cleanup
+# Cleanup.
 #
 
---connection default
---echo
---echo ---> connection: default
-
-DROP USER mysqltest_dfn@localhost;
-DROP USER mysqltest_inv@localhost;
+DROP USER mysqltest_u1@localhost;
 
 DROP DATABASE mysqltest_db1;

--- 1.75/sql/ha_archive.cc	2006-01-17 02:37:21 -05:00
+++ 1.76/sql/ha_archive.cc	2006-01-30 08:46:31 -05:00
@@ -137,6 +137,11 @@
 #define DATA_BUFFER_SIZE 2       // Size of the data used in the data file
 #define ARCHIVE_CHECK_HEADER 254 // The number we use to determine corruption
 
+/* 
+  Number of rows that will force a bulk insert.
+*/
+#define ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT 2
+
 /* Static declarations for handerton */
 static handler *archive_create_handler(TABLE_SHARE *table);
 
@@ -516,7 +521,7 @@
   Init out lock.
   We open the file we will read from.
 */
-int ha_archive::open(const char *name, int mode, uint test_if_locked)
+int ha_archive::open(const char *name, int mode, uint open_options)
 {
   DBUG_ENTER("ha_archive::open");
 
@@ -531,7 +536,10 @@
     DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
   }
 
-  DBUG_RETURN(0);
+  if (open_options & HA_OPEN_FOR_REPAIR)
+    DBUG_RETURN(0);
+
+  DBUG_RETURN(share->crashed ? HA_ERR_CRASHED_ON_USAGE : 0);
 }
 
 
@@ -1302,7 +1310,8 @@
 void ha_archive::start_bulk_insert(ha_rows rows)
 {
   DBUG_ENTER("ha_archive::start_bulk_insert");
-  bulk_insert= TRUE;
+  if (!rows || rows >= ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT)
+    bulk_insert= TRUE;
   DBUG_VOID_RETURN;
 }
 
@@ -1335,7 +1344,8 @@
 */
 bool ha_archive::is_crashed() const 
 {
-  return share->crashed; 
+  DBUG_ENTER("ha_archive::is_crashed");
+  DBUG_RETURN(share->crashed); 
 }
 
 /*
@@ -1397,12 +1407,5 @@
 
   check_opt.init();
 
-  if (check(thd, &check_opt) == HA_ADMIN_CORRUPT)
-  {
-    DBUG_RETURN(repair(thd, &check_opt));
-  }
-  else
-  {
-    DBUG_RETURN(HA_ADMIN_OK);
-  }
+  DBUG_RETURN(repair(thd, &check_opt));
 }

--- 1.43/sql/sql_trigger.cc	2006-01-13 11:04:32 -05:00
+++ 1.44/sql/sql_trigger.cc	2006-01-30 08:46:31 -05:00
@@ -382,7 +382,12 @@
   for (trg_field= (Item_trigger_field *)(lex->trg_table_fields.first);
        trg_field; trg_field= trg_field->next_trg_field)
   {
-    trg_field->setup_field(thd, table);
+    /*
+      NOTE: now we do not check privileges at CREATE TRIGGER time. This will
+      be changed in the future.
+    */
+    trg_field->setup_field(thd, table, NULL);
+
     if (!trg_field->fixed &&
         trg_field->fix_fields(thd, (Item **)0))
       return 1;
@@ -818,8 +823,7 @@
 
       char *trg_name_buff;
       List_iterator_fast<ulonglong> itm(triggers->definition_modes_list);
-      List_iterator_fast<LEX_STRING> it_definer(triggers->
-                                                definers_list);
+      List_iterator_fast<LEX_STRING> it_definer(triggers->definers_list);
       LEX *old_lex= thd->lex, lex;
       sp_rcontext *save_spcont= thd->spcont;
       ulong save_sql_mode= thd->variables.sql_mode;
@@ -834,6 +838,7 @@
       {
         trg_sql_mode= itm++;
         LEX_STRING *trg_definer= it_definer++;
+
         thd->variables.sql_mode= (ulong)*trg_sql_mode;
         lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length);
 
@@ -907,11 +912,11 @@
                (Item_trigger_field *)(lex.trg_table_fields.first);
              trg_field;
              trg_field= trg_field->next_trg_field)
-          trg_field->setup_field(thd, table);
-
-        triggers->m_spec_var_used[lex.trg_chistics.event]
-          [lex.trg_chistics.action_time]=
-          lex.trg_table_fields.first ? TRUE : FALSE;
+        {
+          trg_field->setup_field(thd, table, 
+            &triggers->subject_table_grants[lex.trg_chistics.event]
+                                           [lex.trg_chistics.action_time]);
+        }
 
         lex_end(&lex);
       }
@@ -1162,8 +1167,9 @@
     }
 
     /*
-      If the trigger uses special variables (NEW/OLD), check that we have
-      SELECT and UPDATE privileges on the subject table.
+      Fetch information about table-level privileges to GRANT_INFO structure for
+      subject table. Check of privileges that will use it and information about
+      column-level privileges will happen in Item_trigger_field::fix_fields().
     */
     
     if (is_special_var_used(event, time_type))

--- 1.17/mysql-test/r/rpl_sp.result	2006-01-12 10:45:07 -05:00
+++ 1.18/mysql-test/r/rpl_sp.result	2006-01-30 08:27:36 -05:00
@@ -401,5 +401,18 @@
 select * from t1;
 a
 1
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(col VARCHAR(10));
+CREATE PROCEDURE p1(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg);
+CALL p1('test');
+SELECT * FROM t1;
+col
+test
+SELECT * FROM t1;
+col
+test
+DROP PROCEDURE p1;
 drop table t1;
 reset master;

--- 1.14/mysql-test/t/rpl_sp.test	2006-01-12 11:05:03 -05:00
+++ 1.15/mysql-test/t/rpl_sp.test	2006-01-30 08:27:36 -05:00
@@ -403,6 +403,42 @@
 connection slave;
 select * from t1;
 
+#
+# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary
+# Log for 5.0.18"
+#
+
+# Prepare environment.
+
+connection master;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# Test case.
+
+CREATE TABLE t1(col VARCHAR(10));
+
+CREATE PROCEDURE p1(arg VARCHAR(10))
+  INSERT INTO t1 VALUES(arg);
+
+CALL p1('test');
+
+SELECT * FROM t1;
+
+sync_slave_with_master;
+connection slave;
+
+SELECT * FROM t1;
+
+# Cleanup.
+
+connection master;
+
+DROP PROCEDURE p1;
+
 # cleanup
 connection master;
 drop table t1;

--- 1.68/mysql-test/t/information_schema.test	2006-01-18 21:56:00 -05:00
+++ 1.69/mysql-test/t/information_schema.test	2006-01-30 08:46:31 -05:00
@@ -794,6 +794,25 @@
 DROP VIEW v1;
 DROP FUNCTION func1;
 DROP FUNCTION func2;
+
+#
+# Bug #15851 Unlistable directories yield no info from information_schema
+#
+create database mysqltest;
+create table mysqltest.t1(a int);
+--exec chmod -r $MYSQL_TEST_DIR/var/master-data/mysqltest
+select table_schema from information_schema.tables where table_schema='mysqltest';
+--exec chmod +r $MYSQL_TEST_DIR/var/master-data/mysqltest
+drop database mysqltest;
+
+#
+# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
+#
+select column_type, group_concat(table_schema, '.', table_name), count(*) as num
+from information_schema.columns where
+table_schema='information_schema' and
+(column_type = 'varchar(7)' or column_type = 'varchar(20)')
+group by column_type order by num;
 # Show engines
 #
 

--- 1.9/mysql-test/r/information_schema_db.result	2006-01-10 10:42:19 -05:00
+++ 1.10/mysql-test/r/information_schema_db.result	2006-01-30 08:27:36 -05:00
@@ -18,8 +18,8 @@
 TABLE_CONSTRAINTS
 TABLE_PRIVILEGES
 TRIGGERS
-VIEWS
 USER_PRIVILEGES
+VIEWS
 show tables from INFORMATION_SCHEMA like 'T%';
 Tables_in_information_schema (T%)
 TABLES

--- 1.82/sql-common/client.c	2006-01-03 11:54:34 -05:00
+++ 1.83/sql-common/client.c	2006-01-30 08:27:41 -05:00
@@ -1545,7 +1545,8 @@
   NULL,
   cli_read_statistics,
   cli_read_query_result,
-  cli_read_change_user_result
+  cli_read_change_user_result,
+  cli_read_binary_rows
 #endif
 };
 
@@ -2339,8 +2340,9 @@
   my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
   my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
   my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR));
   /* Clear pointers for better safety */
-  mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
+  mysql->info_buffer=mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
 }
 
 
@@ -2476,8 +2478,7 @@
   if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
     mysql->server_status|= SERVER_STATUS_IN_TRANS;
 
-  if (!(fields=(*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,
-					    protocol_41(mysql) ? 7 : 5)))
+  if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5)))
     DBUG_RETURN(1);
   if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
 				    (uint) field_count,0,

--- 1.36/mysys/my_bitmap.c	2005-07-19 18:40:08 -04:00
+++ 1.37/mysys/my_bitmap.c	2006-01-30 08:46:31 -05:00
@@ -105,6 +105,16 @@
 		    my_bool thread_safe)
 {
   DBUG_ENTER("bitmap_init");
+
+  DBUG_ASSERT((bitmap_size & 7) == 0);
+  bitmap_size/=8;
+  if (!(map->bitmap=buf) &&
+      !(map->bitmap= (uchar*) my_malloc(bitmap_size +
+					(thread_safe ?
+					 sizeof(pthread_mutex_t) : 0),
+					MYF(MY_WME | MY_ZEROFILL))))
+    DBUG_RETURN(1);
+  map->bitmap_size=bitmap_size;
   DBUG_ASSERT(n_bits > 0);
   if (!buf)
   {

--- 1.10/mysql-test/r/view_grant.result	2006-01-19 04:25:04 -05:00
+++ 1.11/mysql-test/r/view_grant.result	2006-01-30 08:27:36 -05:00
@@ -350,12 +350,12 @@
 f2()
 NULL
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 select * from v2;
 f2()
 NULL
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 select * from v3;
 ERROR HY000: View 'mysqltest.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
 select * from v4;
@@ -396,12 +396,12 @@
 f2()
 NULL
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 select * from v4;
 f2()
 NULL
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 select * from v5;
 ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
 drop view v1, v2, v3, v4, v5;

--- 1.7/VC++Files/sql/mysqld.vcproj	2006-01-13 16:09:38 -05:00
+++ 1.8/VC++Files/sql/mysqld.vcproj	2006-01-30 08:46:31 -05:00
@@ -3925,6 +3925,81 @@
 			</FileConfiguration>
 		</File>
 		<File
+			RelativePath="my_user.c">
+			<FileConfiguration
+				Name="classic nt|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Max|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Max nt|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="nt|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="pro nt|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Debug|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="0"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="pro|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="classic|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions=""/>
+			</FileConfiguration>
+		</File>
+		<File
 			RelativePath="..\storage\myisammrg\myrg_rnext_same.c">
 			<FileConfiguration
 				Name="classic nt|Win32">

--- 1.26/mysql-test/r/mysqltest.result	2006-01-23 02:58:08 -05:00
+++ 1.27/mysql-test/r/mysqltest.result	2006-01-30 08:27:36 -05:00
@@ -361,6 +361,7 @@
 mysqltest: In included file "./var/tmp/con.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c
 mysqltest: In included file "./var/tmp/con.sql": At line 3: connection 'test_con1' not found in connection pool
 mysqltest: In included file "./var/tmp/con.sql": At line 2: Connection test_con1 already exists
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
 Output from mysqltest-x.inc
 Output from mysqltest-x.inc
 Output from mysqltest-x.inc

--- 1.31/mysql-test/t/mysqltest.test	2006-01-19 04:28:59 -05:00
+++ 1.32/mysql-test/t/mysqltest.test	2006-01-30 08:27:36 -05:00
@@ -909,7 +909,13 @@
 --error 1
 --exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
 
-
+# connect when "disable_abort_on_error" caused "connection not found"
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--disable_abort_on_error
+connect (con1,localhost,root,,);
+connection default;
+connection con1;
+--enable_abort_on_error
 
 # ----------------------------------------------------------------------------
 # Test mysqltest arguments

--- 1.7/zlib/Makefile.am	2005-12-18 12:02:38 -05:00
+++ 1.8/zlib/Makefile.am	2006-01-30 08:27:43 -05:00
@@ -16,6 +16,8 @@
 
 # Process this file with automake to create Makefile.in
 
+INCLUDES=		-I$(top_builddir)/include -I$(top_srcdir)/include
+
 pkglib_LTLIBRARIES=libz.la
 
 libz_la_LDFLAGS= -version-info 3:3:2

--- 1.42.5.1/ndb/include/mgmapi/mgmapi.h	2006-01-16 08:13:13 -05:00
+++ 1.49/storage/ndb/include/mgmapi/mgmapi.h	2006-01-30 08:27:42 -05:00
@@ -171,7 +171,6 @@
     = NODE_TYPE_MGM
 #endif
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
-    ,NDB_MGM_NODE_TYPE_REP = NODE_TYPE_REP  /** A replication node */
     ,NDB_MGM_NODE_TYPE_MIN     = 0          /** Min valid value*/
     ,NDB_MGM_NODE_TYPE_MAX     = 3          /** Max valid value*/
 #endif

--- 1.24.8.1/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2006-01-16 08:13:13 -05:00
+++ 1.33/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2006-01-30 08:27:42 -05:00
@@ -63,7 +63,10 @@
 
   if (ndb_mgm_set_connectstring(m_handle, _connect_string))
   {
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
     DBUG_VOID_RETURN;
   }
   resetError();
@@ -150,7 +153,10 @@
   ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle,m_version);
   if(conf == 0)
   {
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
     return 0;
   }
   return conf;
@@ -359,7 +365,10 @@
       no_retries--;
       NdbSleep_SecSleep(retry_delay_in_seconds);
     }
-    setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
+    BaseString tmp(ndb_mgm_get_latest_error_msg(m_handle));
+    tmp.append(" : ");
+    tmp.append(ndb_mgm_get_latest_error_desc(m_handle));
+    setError(CR_ERROR, tmp.c_str());
   } else
     setError(CR_ERROR, "management server handle not initialized");    
   return 0;

--- 1.39.2.1/ndb/src/kernel/vm/Configuration.cpp	2006-01-16 08:13:13 -05:00
+++ 1.44/storage/ndb/src/kernel/vm/Configuration.cpp	2006-01-30 08:27:42 -05:00
@@ -592,13 +592,9 @@
     case NODE_TYPE_API:
       noOfAPINodes++; // No of API processes
       break;
-    case NODE_TYPE_REP:
-      break;
     case NODE_TYPE_MGM:
       noOfMGMNodes++; // No of MGM processes
       break;
-    case NODE_TYPE_EXT_REP:
-      break;
     default:
       BaseString::snprintf(buf, sizeof(buf), "Unknown node type: %d", nodeType);
       ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
@@ -663,14 +659,14 @@
      */
     // Can keep 65536 pages (= 0.5 GByte)
     cfg.put(CFG_ACC_DIR_RANGE, 
-	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 
+	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas); 
     
     cfg.put(CFG_ACC_DIR_ARRAY,
 	    (noOfIndexPages >> 8) + 
-	    4 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     cfg.put(CFG_ACC_FRAGMENT,
-	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     /*-----------------------------------------------------------------------*/
     // The extra operation records added are used by the scan and node 
@@ -686,14 +682,11 @@
     
     cfg.put(CFG_ACC_OVERFLOW_RECS,
 	    noOfIndexPages + 
-	    2 * NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
     
     cfg.put(CFG_ACC_PAGE8, 
 	    noOfIndexPages + 32);
     
-    cfg.put(CFG_ACC_ROOT_FRAG, 
-	    NO_OF_FRAG_PER_NODE * noOfAccTables* noOfReplicas);
-    
     cfg.put(CFG_ACC_TABLE, noOfAccTables);
     
     cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords);
@@ -776,7 +769,7 @@
      * Tup Size Alt values
      */
     cfg.put(CFG_TUP_FRAG, 
-	    2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
     
     cfg.put(CFG_TUP_OP_RECS, 
 	    noOfLocalOperations + 50);
@@ -785,14 +778,14 @@
 	    noOfDataPages);
     
     cfg.put(CFG_TUP_PAGE_RANGE, 
-	    4 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
+	    2 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas);
     
     cfg.put(CFG_TUP_TABLE, 
 	    noOfMetaTables);
     
     cfg.put(CFG_TUP_TABLE_DESC, 
-	    2 * 6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
-	    2 * 10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
+	    6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
+	    10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
     
     cfg.put(CFG_TUP_STORED_PROC,
 	    noOfLocalScanRecords);
@@ -806,7 +799,7 @@
 	    noOfMetaTables /*noOfOrderedIndexes*/);
     
     cfg.put(CFG_TUX_FRAGMENT,
-	    2 * NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
+	    NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
     
     cfg.put(CFG_TUX_ATTRIBUTE, 
 	    noOfOrderedIndexes * 4);

--- 1.44.14.1/ndb/src/mgmapi/mgmapi.cpp	2006-01-16 08:13:13 -05:00
+++ 1.59/storage/ndb/src/mgmapi/mgmapi.cpp	2006-01-30 08:27:42 -05:00
@@ -184,7 +184,7 @@
     handle->cfg.~LocalConfig();
     new (&(handle->cfg)) LocalConfig;
     handle->cfg.init(0, 0); /* reset the LocalConfig */
-    SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
+    SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, mgmsrv ? mgmsrv : "");
     DBUG_RETURN(-1);
   }
   handle->cfg_i= -1;

--- 1.49.7.1/ndb/src/mgmclient/CommandInterpreter.cpp	2006-01-16 08:13:13 -05:00
+++ 1.59/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2006-01-30 08:27:42 -05: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>
 
 class MgmtSrvr;
@@ -158,11 +151,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;
 };
 
@@ -220,10 +208,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>
@@ -251,9 +235,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
@@ -277,9 +258,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"
@@ -297,39 +275,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"
@@ -401,11 +346,6 @@
   m_connected= false;
   m_event_thread= 0;
   try_reconnect = 0;
-#ifdef HAVE_GLOBAL_REPLICATION
-  rep_host = NULL;
-  m_repserver = NULL;
-  rep_connected = false;
-#endif
 }
 
 /*
@@ -698,13 +638,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 ", 
@@ -967,11 +900,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;
@@ -1216,8 +1144,6 @@
       case NDB_MGM_NODE_TYPE_UNKNOWN:
         ndbout << "Error: Unknown Node Type" << endl;
         return;
-      case NDB_MGM_NODE_TYPE_REP:
-	abort();
       }
     }
 
@@ -2094,226 +2020,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.73.17.2/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-01-19 03:14:13 -05:00
+++ 1.89/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2006-01-30 08:27:42 -05:00
@@ -37,7 +37,6 @@
 #include <signaldata/EventReport.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 #include <signaldata/BackupSignalData.hpp>
-#include <signaldata/GrepImpl.hpp>
 #include <signaldata/ManagementServer.hpp>
 #include <signaldata/NFCompleteRep.hpp>
 #include <signaldata/NodeFailRep.hpp>
@@ -479,10 +478,6 @@
       case NODE_TYPE_MGM:
 	nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
 	break;
-      case NODE_TYPE_REP:
-	nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
-	break;
-      case NODE_TYPE_EXT_REP:
       default:
 	break;
       }
@@ -1726,9 +1721,6 @@
     break;
   case GSN_EVENT_REP:
   {
-    EventReport *rep = CAST_PTR(EventReport, signal->getDataPtrSend());
-    if (rep->getNodeId() == 0)
-      rep->setNodeId(refToNode(signal->theSendersBlockRef));
     eventReport(signal->getDataPtr());
     break;
   }
@@ -1769,7 +1761,6 @@
       DBUG_VOID_RETURN;
     }
   }
-  
   rep->setNodeId(_ownNodeId);
   eventReport(theData);
   DBUG_VOID_RETURN;
@@ -2288,17 +2279,6 @@
   return ss.sendSignal(nodeId, &ssig) == SEND_OK ? 0 : SEND_OR_RECEIVE_FAILED;
 }
 
-
-/*****************************************************************************
- * Global Replication
- *****************************************************************************/
-
-int
-MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
-{
-  require(false);
-  return 0;
-}
 
 MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
   : m_mgmsrv(m)

--- 1.30.9.1/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-01-16 08:13:14 -05:00
+++ 1.40/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2006-01-30 08:27:42 -05:00
@@ -339,11 +339,6 @@
   int abortBackup(Uint32 backupId);
   int performBackup(Uint32* backupId);
 
-  /**
-   * Global Replication
-   */
-  int repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted = false);
-  
   //**************************************************************************
   // Description: Set event report level for a DB process
   // Parameters:

--- 1.34.7.2/innobase/include/os0file.h	2006-01-16 06:03:55 -05:00
+++ 1.43/storage/innobase/include/os0file.h	2006-01-30 08:27:41 -05:00
@@ -188,7 +188,7 @@
 FILE*
 os_file_create_tmpfile(void);
 /*========================*/
-			/* out: temporary file handle, or NULL on error */
+			/* out: temporary file handle (never NULL) */
 /***************************************************************************
 The os_file_opendir() function opens a directory stream corresponding to the
 directory named by the dirname argument. The directory stream is positioned

--- 1.39.5.1/innobase/include/row0mysql.h	2006-01-16 06:03:55 -05:00
+++ 1.46/storage/innobase/include/row0mysql.h	2006-01-30 08:27:41 -05:00
@@ -613,6 +613,31 @@
 					that was decided in ha_innodb.cc,
 					::store_lock(), ::external_lock(),
 					etc. */
+	ulint		row_read_type;	/* ROW_READ_WITH_LOCKS if row locks
+					should be the obtained for records
+					under an UPDATE or DELETE cursor.
+					If innodb_locks_unsafe_for_binlog
+					is TRUE, this can be set to
+					ROW_READ_TRY_SEMI_CONSISTENT, so that
+					if the row under an UPDATE or DELETE
+					cursor was locked by another
+					transaction, InnoDB will resort
+					to reading the last committed value
+					('semi-consistent read').  Then,
+					this field will be set to
+					ROW_READ_DID_SEMI_CONSISTENT to
+					indicate that.  If the row does not
+					match the WHERE condition, MySQL will
+					invoke handler::unlock_row() to
+					clear the flag back to
+					ROW_READ_TRY_SEMI_CONSISTENT and
+					to simply skip the row.  If
+					the row matches, the next call to
+					row_search_for_mysql() will lock
+					the row.
+					This eliminates lock waits in some
+					cases; note that this breaks
+					serializability. */
 	ulint		mysql_prefix_len;/* byte offset of the end of
 					the last requested column */
 	ulint		mysql_row_len;	/* length in bytes of a row in the
@@ -657,6 +682,11 @@
 /* Values for hint_need_to_fetch_extra_cols */
 #define ROW_RETRIEVE_PRIMARY_KEY	1
 #define ROW_RETRIEVE_ALL_COLS		2
+
+/* Values for row_read_type */
+#define ROW_READ_WITH_LOCKS		0
+#define ROW_READ_TRY_SEMI_CONSISTENT	1
+#define ROW_READ_DID_SEMI_CONSISTENT	2
 
 
 #ifndef UNIV_NONINL

--- 1.51.7.2/innobase/include/srv0srv.h	2006-01-18 07:20:46 -05:00
+++ 1.59/storage/innobase/include/srv0srv.h	2006-01-30 08:27:41 -05:00
@@ -34,18 +34,6 @@
 extern mutex_t	srv_monitor_file_mutex;
 /* Temporary file for innodb monitor output */
 extern FILE*	srv_monitor_file;
-/* Mutex for locking srv_dict_tmpfile.
-This mutex has a very high rank; threads reserving it should not
-be holding any InnoDB latches. */
-extern mutex_t	srv_dict_tmpfile_mutex;
-/* Temporary file for output from the data dictionary */
-extern FILE*	srv_dict_tmpfile;
-/* Mutex for locking srv_misc_tmpfile.
-This mutex has a very low rank; threads reserving it should not
-acquire any further latches or sleep before releasing this one. */
-extern mutex_t	srv_misc_tmpfile_mutex;
-/* Temporary file for miscellanous diagnostic output */
-extern FILE*	srv_misc_tmpfile;
 
 /* Server parameters which are read from the initfile */
 

--- 1.55.7.1/innobase/lock/lock0lock.c	2006-01-16 06:03:55 -05:00
+++ 1.65/storage/innobase/lock/lock0lock.c	2006-01-30 08:46:32 -05:00
@@ -1705,7 +1705,7 @@
 lock_t*
 lock_rec_create(
 /*============*/
-				/* out: created lock, NULL if out of memory */
+				/* out: created lock */
 	ulint		type_mode,/* in: lock mode and wait flag, type is
 				ignored and replaced by LOCK_REC */
 	rec_t*		rec,	/* in: record on page */
@@ -1746,11 +1746,6 @@
 	n_bytes = 1 + n_bits / 8;
 
 	lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t) + n_bytes);
-	
-	if (UNIV_UNLIKELY(lock == NULL)) {
-
-		return(NULL);
-	}
 
 	UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock);
 
@@ -1886,8 +1881,7 @@
 lock_t*
 lock_rec_add_to_queue(
 /*==================*/
-				/* out: lock where the bit was set, NULL if out
-				of memory */
+				/* out: lock where the bit was set */
 	ulint		type_mode,/* in: lock mode, wait, gap etc. flags;
 				type is ignored and replaced by LOCK_REC */
 	rec_t*		rec,	/* in: record on page */
@@ -3405,8 +3399,7 @@
 lock_t*
 lock_table_create(
 /*==============*/
-				/* out, own: new lock object, or NULL if
-				out of memory */
+				/* out, own: new lock object */
 	dict_table_t*	table,	/* in: database table in dictionary cache */
 	ulint		type_mode,/* in: lock mode possibly ORed with
 				LOCK_WAIT */
@@ -3432,11 +3425,6 @@
 		lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t));
 	}
 
-	if (lock == NULL) {
-
-		return(NULL);
-	}
-
 	UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock);
 
 	lock->type_mode = type_mode | LOCK_TABLE;
@@ -3773,9 +3761,8 @@
 	rec_t*	rec,		/* in: record */
 	ulint	lock_mode)	/* in: LOCK_S or LOCK_X */
 {
-	lock_t*	lock;
-	lock_t*	release_lock	= NULL;
-	ulint	heap_no;
+	lock_t* lock;
+	ulint heap_no;
 
 	ut_ad(trx && rec);
 
@@ -3785,23 +3772,21 @@
 
 	lock = lock_rec_get_first(rec);
 
-	/* Find the last lock with the same lock_mode and transaction
-	from the record. */
+	/* Remove the record lock */
 
 	while (lock != NULL) {
 		if (lock->trx == trx && lock_get_mode(lock) == lock_mode) {
-			release_lock = lock;
 			ut_a(!lock_get_wait(lock));
+
+			lock_rec_reset_nth_bit(lock, heap_no);
+
+			break;
 		}
 
 		lock = lock_rec_get_next(rec, lock);
 	}
 
-	/* If a record lock is found, release the record lock */
-
-	if (UNIV_LIKELY(release_lock != NULL)) {
-		lock_rec_reset_nth_bit(release_lock, heap_no);
-	} else {
+	if (UNIV_UNLIKELY(lock == NULL)) {
 		mutex_exit(&kernel_mutex);
 		ut_print_timestamp(stderr);
 		fprintf(stderr,

--- 1.65.10.1/innobase/row/row0ins.c	2006-01-16 06:03:55 -05:00
+++ 1.75/storage/innobase/row/row0ins.c	2006-01-30 08:27:41 -05:00
@@ -597,21 +597,20 @@
 	trx_t*		trx,		/* in: transaction */
 	dict_foreign_t*	foreign)	/* in: foreign key constraint */
 {
-	mutex_enter(&srv_misc_tmpfile_mutex);
-	rewind(srv_misc_tmpfile);
+		
+	FILE*	tf = os_file_create_tmpfile();
 
-	if (os_file_set_eof(srv_misc_tmpfile)) {
-		ut_print_name(srv_misc_tmpfile, trx,
-				foreign->foreign_table_name);
-		dict_print_info_on_foreign_key_in_create_format(
-				srv_misc_tmpfile,
-				trx, foreign, FALSE);
-		trx_set_detailed_error_from_file(trx, srv_misc_tmpfile);
+	if (tf) {
+		ut_print_name(tf, trx, foreign->foreign_table_name);
+		dict_print_info_on_foreign_key_in_create_format(tf, trx,
+			foreign, FALSE);
+
+		trx_set_detailed_error_from_file(trx, tf);
+
+		fclose(tf);
 	} else {
-		trx_set_detailed_error(trx, "temp file operation failed");
+		trx_set_detailed_error(trx, "temp file creation failed");
 	}
-
-	mutex_exit(&srv_misc_tmpfile_mutex);
 }
 
 /*************************************************************************
@@ -719,7 +718,7 @@
 	}
 
 	if (rec) {
-		rec_print(ef, rec, foreign->referenced_index);
+		rec_print(ef, rec, foreign->foreign_index);
 	}
 	putc('\n', ef);
 

--- 1.103.12.1/innobase/row/row0mysql.c	2006-01-16 06:03:55 -05:00
+++ 1.120/storage/innobase/row/row0mysql.c	2006-01-30 08:27:41 -05:00
@@ -626,6 +626,8 @@
 	prebuilt->select_lock_type = LOCK_NONE;
 	prebuilt->stored_select_lock_type = 99999999;
 
+	prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
+
 	prebuilt->sel_graph = NULL;
 
 	prebuilt->search_tuple = dtuple_create(heap,
@@ -2132,7 +2134,7 @@
 
 	if (err == DB_SUCCESS) {
 		/* Check that also referencing constraints are ok */
-		err = dict_load_foreigns(name, TRUE);
+		err = dict_load_foreigns(name, trx->check_foreigns);
 	}
 
 	if (err != DB_SUCCESS) {
@@ -3490,7 +3492,8 @@
 	const char*	name)	/* in: table name in the form
 				'database/tablename' */
 {
-	return(strstr(name, "/#sql") != NULL);
+	/* return(strstr(name, "/#sql") != NULL); */
+	return(strstr(name, "/@0023sql") != NULL);
 }
 
 /*************************************************************************
@@ -3590,8 +3593,7 @@
 	mem_heap_t*	heap			= NULL;
 	const char**	constraints_to_drop	= NULL;
 	ulint		n_constraints_to_drop	= 0;
-	ibool           recovering_temp_table   = FALSE;
-	ibool		old_is_tmp, new_is_tmp;
+        ibool           recovering_temp_table   = FALSE;
 	ulint		len;
 	ulint		i;
         ibool		success;
@@ -3631,9 +3633,6 @@
 	trx->op_info = "renaming table";
 	trx_start_if_not_started(trx);
 
-	old_is_tmp = row_is_mysql_tmp_table_name(old_name);
-	new_is_tmp = row_is_mysql_tmp_table_name(new_name);
-	
 	if (row_mysql_is_recovered_tmp_table(new_name)) {
 
                 recovering_temp_table = TRUE;
@@ -3680,7 +3679,7 @@
 	len = (sizeof str1) + (sizeof str2) + (sizeof str3) + (sizeof str5) - 4
 		+ ut_strlenq(new_name, '\'') + ut_strlenq(old_name, '\'');
 
-	if (new_is_tmp) {
+	if (row_is_mysql_tmp_table_name(new_name)) {
 		db_name_len = dict_get_db_name_len(old_name) + 1;
 
 		/* MySQL is doing an ALTER TABLE command and it renames the
@@ -3833,7 +3832,7 @@
 		the table is stored in a single-table tablespace */
 
 		success = dict_table_rename_in_cache(table, new_name,
-				!new_is_tmp);
+				!row_is_mysql_tmp_table_name(new_name));
 		if (!success) {
 			trx->error_state = DB_SUCCESS;
 			trx_general_rollback_for_mysql(trx, FALSE, NULL);
@@ -3850,16 +3849,19 @@
 			goto funct_exit;
 		}
 
-		/* We only want to switch off some of the type checking in
-		an ALTER, not in a RENAME. */
-		
-		err = dict_load_foreigns(new_name,
-			old_is_tmp ? trx->check_foreigns : TRUE);
+		err = dict_load_foreigns(new_name, trx->check_foreigns);
 
-		if (err != DB_SUCCESS) {
-			ut_print_timestamp(stderr);
+		if (row_is_mysql_tmp_table_name(old_name)) {
 
-			if (old_is_tmp) {
+			/* MySQL is doing an ALTER TABLE command and it
+			renames the created temporary table to the name
+			of the original table. In the ALTER TABLE we maybe
+			created some FOREIGN KEY constraints for the temporary
+			table. But we want to load also the foreign key
+			constraint definitions for the original table name. */
+
+			if (err != DB_SUCCESS) {
+	    			ut_print_timestamp(stderr);
 				fputs("  InnoDB: Error: in ALTER TABLE ",
 					stderr);
 				ut_print_name(stderr, trx, new_name);
@@ -3867,23 +3869,36 @@
 	"InnoDB: has or is referenced in foreign key constraints\n"
 	"InnoDB: which are not compatible with the new table definition.\n",
 					stderr);
-			} else {
+
+				ut_a(dict_table_rename_in_cache(table,
+					old_name, FALSE));
+				trx->error_state = DB_SUCCESS;
+				trx_general_rollback_for_mysql(trx, FALSE,
+									NULL);
+				trx->error_state = DB_SUCCESS;
+			}
+		} else {
+			if (err != DB_SUCCESS) {
+
+	    			ut_print_timestamp(stderr);
+
 				fputs(
 				"  InnoDB: Error: in RENAME TABLE table ",
 					stderr);
 				ut_print_name(stderr, trx, new_name);
 				fputs("\n"
-	"InnoDB: is referenced in foreign key constraints\n"
-	"InnoDB: which are not compatible with the new table definition.\n",
+     "InnoDB: is referenced in foreign key constraints\n"
+     "InnoDB: which are not compatible with the new table definition.\n",
 					stderr);
-			}
-
-			ut_a(dict_table_rename_in_cache(table,
+     
+				ut_a(dict_table_rename_in_cache(table,
 					old_name, FALSE));
-			trx->error_state = DB_SUCCESS;
-			trx_general_rollback_for_mysql(trx, FALSE,
-				NULL);
-			trx->error_state = DB_SUCCESS;
+						
+				trx->error_state = DB_SUCCESS;
+				trx_general_rollback_for_mysql(trx, FALSE,
+									NULL);
+				trx->error_state = DB_SUCCESS;
+			}
 		}
 	}
 funct_exit:	

--- 1.92.5.1/innobase/row/row0sel.c	2006-01-16 06:03:55 -05:00
+++ 1.100/storage/innobase/row/row0sel.c	2006-01-30 08:27:41 -05:00
@@ -536,6 +536,41 @@
 }
 
 /*************************************************************************
+Builds the last committed version of a clustered index record for a
+semi-consistent read. */
+static
+ulint
+row_sel_build_committed_vers_for_mysql(
+/*===================================*/
+					/* out: DB_SUCCESS or error code */
+	dict_index_t*	clust_index,	/* in: clustered index */
+	row_prebuilt_t*	prebuilt,	/* in: prebuilt struct */
+	rec_t*		rec,		/* in: record in a clustered index */
+	ulint**		offsets,	/* in/out: offsets returned by
+					rec_get_offsets(rec, clust_index) */
+	mem_heap_t**	offset_heap,	/* in/out: memory heap from which
+					the offsets are allocated */
+	rec_t**		old_vers,	/* out: old version, or NULL if the
+					record does not exist in the view:
+					i.e., it was freshly inserted
+					afterwards */
+	mtr_t*		mtr)		/* in: mtr */
+{
+	ulint	err;
+
+	if (prebuilt->old_vers_heap) {
+		mem_heap_empty(prebuilt->old_vers_heap);
+	} else {
+		prebuilt->old_vers_heap = mem_heap_create(200);
+	}
+	
+	err = row_vers_build_for_semi_consistent_read(rec, mtr, clust_index,
+					offsets, offset_heap,
+					prebuilt->old_vers_heap, old_vers);
+	return(err);
+}
+
+/*************************************************************************
 Tests the conditions which determine when the index segment we are searching
 through has been exhausted. */
 UNIV_INLINE
@@ -3066,7 +3101,6 @@
 	rec_t*		rec;
 	rec_t*		result_rec;
 	rec_t*		clust_rec;
-	rec_t*		old_vers;
 	ulint		err				= DB_SUCCESS;
 	ibool		unique_search			= FALSE;
 	ibool		unique_search_from_clust_index	= FALSE;
@@ -3077,6 +3111,11 @@
 					locking SELECT, and the isolation
 					level is <= TRX_ISO_READ_COMMITTED,
 					then this is set to FALSE */
+	ibool		did_semi_consistent_read	= FALSE;
+					/* if the returned record was locked
+					and we did a semi-consistent read
+					(fetch the newest committed version),
+					then this is set to TRUE */
 #ifdef UNIV_SEARCH_DEBUG
 	ulint		cnt				= 0;
 #endif /* UNIV_SEARCH_DEBUG */
@@ -3163,7 +3202,7 @@
 		trx->search_latch_timeout = BTR_SEA_TIMEOUT;
 	}
 	
-	/* Reset the new record lock info if we srv_locks_unsafe_for_binlog
+	/* Reset the new record lock info if srv_locks_unsafe_for_binlog
 	is set. Then we are able to remove the record locks set here on an
 	individual row. */
 
@@ -3431,9 +3470,28 @@
 	clust_index = dict_table_get_first_index(index->table);
 
 	if (UNIV_LIKELY(direction != 0)) {
-		if (!sel_restore_position_for_mysql(&same_user_rec,
-						BTR_SEARCH_LEAF,
-						pcur, moves_up, &mtr)) {
+		ibool	need_to_process = sel_restore_position_for_mysql(
+				&same_user_rec, BTR_SEARCH_LEAF,
+				pcur, moves_up, &mtr);
+
+		if (UNIV_UNLIKELY(need_to_process)) {
+			if (UNIV_UNLIKELY(prebuilt->row_read_type
+					== ROW_READ_DID_SEMI_CONSISTENT)) {
+				/* We did a semi-consistent read,
+				but the record was removed in
+				the meantime. */
+				prebuilt->row_read_type
+					= ROW_READ_TRY_SEMI_CONSISTENT;
+			}
+		} else if (UNIV_LIKELY(prebuilt->row_read_type
+			   != ROW_READ_DID_SEMI_CONSISTENT)) {
+
+			/* The cursor was positioned on the record
+			that we returned previously.  If we need
+			to repeat a semi-consistent read as a
+			pessimistic locking read, the record
+			cannot be skipped. */
+
 			goto next_rec;
 		}
 
@@ -3751,7 +3809,64 @@
 					prebuilt->select_lock_type,
 					lock_type, thr);
 
-		if (err != DB_SUCCESS) {
+		switch (err) {
+			rec_t*	old_vers;
+		case DB_SUCCESS:
+			break;
+		case DB_LOCK_WAIT:
+			if (UNIV_LIKELY(prebuilt->row_read_type
+			    != ROW_READ_TRY_SEMI_CONSISTENT)
+			    || index != clust_index) {
+
+				goto lock_wait_or_error;
+			}
+
+			/* The following call returns 'offsets'
+			associated with 'old_vers' */
+			err = row_sel_build_committed_vers_for_mysql(
+					clust_index, prebuilt, rec,
+					&offsets, &heap,
+					&old_vers, &mtr);
+
+			if (err != DB_SUCCESS) {
+
+				goto lock_wait_or_error;
+			}
+
+			mutex_enter(&kernel_mutex);
+			if (trx->was_chosen_as_deadlock_victim) {
+				mutex_exit(&kernel_mutex);
+
+				goto lock_wait_or_error;
+			}
+			if (UNIV_LIKELY(trx->wait_lock != NULL)) {
+				lock_cancel_waiting_and_release(
+						trx->wait_lock);
+				trx_reset_new_rec_lock_info(trx);
+			} else {
+				mutex_exit(&kernel_mutex);
+
+				/* The lock was granted while we were
+				searching for the last committed version.
+				Do a normal locking read. */
+
+				offsets = rec_get_offsets(rec, index, offsets,
+						ULINT_UNDEFINED, &heap);
+				err = DB_SUCCESS;
+				break;
+			}
+			mutex_exit(&kernel_mutex);
+
+			if (old_vers == NULL) {
+				/* The row was not yet committed */
+
+				goto next_rec;
+			}
+
+			did_semi_consistent_read = TRUE;
+			rec = old_vers;
+			break;
+		default:
 
 			goto lock_wait_or_error;
 		}
@@ -3775,6 +3890,7 @@
                             && !lock_clust_rec_cons_read_sees(rec, index,
 						offsets, trx->read_view)) {
 
+				rec_t*	old_vers;
 				/* The following call returns 'offsets'
 				associated with 'old_vers' */
 				err = row_sel_build_prev_vers_for_mysql(
@@ -3821,14 +3937,13 @@
 		/* The record is delete-marked: we can skip it */
 
 		if (srv_locks_unsafe_for_binlog
-	    	    && prebuilt->select_lock_type != LOCK_NONE) {
+	    	    && prebuilt->select_lock_type != LOCK_NONE
+		    && !did_semi_consistent_read) {
 
 			/* No need to keep a lock on a delete-marked record
 			if we do not want to use next-key locking. */
 
 			row_unlock_for_mysql(prebuilt, TRUE);
-			
-			trx_reset_new_rec_lock_info(trx);
 		}
 		
 		goto next_rec;
@@ -3882,8 +3997,6 @@
 				locking. */
 
 				row_unlock_for_mysql(prebuilt, TRUE);
-			
-				trx_reset_new_rec_lock_info(trx);
 			}
 
 			goto next_rec;
@@ -3990,6 +4103,19 @@
 	goto normal_return;
 
 next_rec:
+	/* Reset the old and new "did semi-consistent read" flags. */
+	if (UNIV_UNLIKELY(prebuilt->row_read_type
+			== ROW_READ_DID_SEMI_CONSISTENT)) {
+		prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
+	}
+	did_semi_consistent_read = FALSE;
+
+	if (UNIV_UNLIKELY(srv_locks_unsafe_for_binlog)
+	    && prebuilt->select_lock_type != LOCK_NONE) {
+
+		trx_reset_new_rec_lock_info(trx);
+	}
+
 	/*-------------------------------------------------------------*/
 	/* PHASE 5: Move the cursor to the next index record */
 
@@ -4042,8 +4168,14 @@
 	goto rec_loop;
 
 lock_wait_or_error:
-	/*-------------------------------------------------------------*/
+	/* Reset the old and new "did semi-consistent read" flags. */
+	if (UNIV_UNLIKELY(prebuilt->row_read_type
+				== ROW_READ_DID_SEMI_CONSISTENT)) {
+		prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
+	}
+	did_semi_consistent_read = FALSE;
 
+	/*-------------------------------------------------------------*/
 	btr_pcur_store_position(pcur, &mtr);
 
 	mtr_commit(&mtr);
@@ -4125,6 +4257,20 @@
 	trx->op_info = "";
 	if (UNIV_LIKELY_NULL(heap)) {
 		mem_heap_free(heap);
+	}
+
+	/* Set or reset the "did semi-consistent read" flag on return.
+	The flag did_semi_consistent_read is set if and only if
+	the record being returned was fetched with a semi-consistent read. */
+	ut_ad(prebuilt->row_read_type != ROW_READ_WITH_LOCKS
+		|| !did_semi_consistent_read);
+
+	if (UNIV_UNLIKELY(prebuilt->row_read_type != ROW_READ_WITH_LOCKS)) {
+		if (UNIV_UNLIKELY(did_semi_consistent_read)) {
+			prebuilt->row_read_type = ROW_READ_DID_SEMI_CONSISTENT;
+		} else {
+			prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
+		}
 	}
 	return(err);
 }

--- 1.87.9.2/innobase/srv/srv0srv.c	2006-01-18 07:20:46 -05:00
+++ 1.96/storage/innobase/srv/srv0srv.c	2006-01-30 08:27:42 -05:00
@@ -398,18 +398,6 @@
 mutex_t	srv_monitor_file_mutex;
 /* Temporary file for innodb monitor output */
 FILE*	srv_monitor_file;
-/* Mutex for locking srv_dict_tmpfile.
-This mutex has a very high rank; threads reserving it should not
-be holding any InnoDB latches. */
-mutex_t	srv_dict_tmpfile_mutex;
-/* Temporary file for output from the data dictionary */
-FILE*	srv_dict_tmpfile;
-/* Mutex for locking srv_misc_tmpfile.
-This mutex has a very low rank; threads reserving it should not
-acquire any further latches or sleep before releasing this one. */
-mutex_t	srv_misc_tmpfile_mutex;
-/* Temporary file for miscellanous diagnostic output */
-FILE*	srv_misc_tmpfile;
 
 ulint	srv_main_thread_process_no	= 0;
 ulint	srv_main_thread_id		= 0;

--- 1.154/mysql-test/r/innodb.result	2006-01-19 04:25:04 -05:00
+++ 1.155/mysql-test/r/innodb.result	2006-01-30 08:27:36 -05:00
@@ -1783,15 +1783,15 @@
 innodb_sync_spin_loops	20
 show variables like "innodb_thread_concurrency";
 Variable_name	Value
-innodb_thread_concurrency	20
-set global innodb_thread_concurrency=1000;
+innodb_thread_concurrency	0
+set global innodb_thread_concurrency=1001;
 show variables like "innodb_thread_concurrency";
 Variable_name	Value
 innodb_thread_concurrency	1000
 set global innodb_thread_concurrency=0;
 show variables like "innodb_thread_concurrency";
 Variable_name	Value
-innodb_thread_concurrency	1
+innodb_thread_concurrency	0
 set global innodb_thread_concurrency=16;
 show variables like "innodb_thread_concurrency";
 Variable_name	Value
@@ -2661,6 +2661,32 @@
 insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
 insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	05630563	05630563	email
+4	0563	0563	email
+4	05612020	05612020	email
+4	01FC	01FC	email
+4	0120	0120	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	0000E400	0000E400	email
+4	0000563001FC0563	0000563001FC0563	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
 drop table t1;
 drop table t2;
 create table t1 (
@@ -2689,6 +2715,32 @@
 insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
 insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	05630563	05630563	email
+4	0563	0563	email
+4	05612020	05612020	email
+4	01FC	01FC	email
+4	0120	0120	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	0000E400	0000E400	email
+4	0000563001FC0563	0000563001FC0563	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
 drop table t1;
 drop table t2;
 create table t1 (
@@ -2717,6 +2769,32 @@
 insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
 insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	0120	0120	email
+4	01FC	01FC	email
+4	0563	0563	email
+4	0000563001FC0563	0000563001FC0563	email
+4	0000E400	0000E400	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	05612020	05612020	email
+4	05630563	05630563	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
 drop table t1;
 drop table t2;
 create table t1 (
@@ -2741,6 +2819,28 @@
 insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
 insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	0000E400	0000E400	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	0120	0120	email
+4	01FC	01FC	email
+4	05612020	05612020	email
+4	0563	0563	email
+1	61626364656667	61626364656667	one
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
 drop table t1;
 drop table t2;
 commit;
@@ -2757,4 +2857,208 @@
 e varchar(255) character set utf8,
 key (a,b,c,d,e)) engine=innodb;
 ERROR 42000: Specified key was too long; max key length is 3072 bytes
-End of 5.0 tests
+create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
+create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
+create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
+create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
+insert into t1 values (0x41),(0x4120),(0x4100);
+insert into t2 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A' for key 1
+insert into t2 values (0x41),(0x4120);
+insert into t3 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A ' for key 1
+insert into t3 values (0x41),(0x4100);
+insert into t4 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A' for key 1
+insert into t4 values (0x41),(0x4100);
+select hex(s1) from t1;
+hex(s1)
+41
+4100
+4120
+select hex(s1) from t2;
+hex(s1)
+4100
+4120
+select hex(s1) from t3;
+hex(s1)
+4100
+41
+select hex(s1) from t4;
+hex(s1)
+4100
+41
+drop table t1,t2,t3,t4;
+create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
+create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
+insert into t2 values(0x42);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+insert into t2 values(0x41);
+select hex(s1) from t2;
+hex(s1)
+4100
+update t1 set s1=0x123456 where a=2;
+select hex(s1) from t2;
+hex(s1)
+4100
+update t1 set s1=0x12 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x12345678 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x123457 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x1220 where a=1;
+select hex(s1) from t2;
+hex(s1)
+1220
+update t1 set s1=0x1200 where a=1;
+select hex(s1) from t2;
+hex(s1)
+1200
+update t1 set s1=0x4200 where a=1;
+select hex(s1) from t2;
+hex(s1)
+4200
+delete from t1 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+delete from t1 where a=2;
+update t2 set s1=0x4120;
+delete from t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+delete from t1 where a!=3;
+select a,hex(s1) from t1;
+a	hex(s1)
+3	4120
+select hex(s1) from t2;
+hex(s1)
+4120
+drop table t2,t1;
+create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
+create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+insert into t1 values(1,0x4100),(2,0x41);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+hex(s1)
+41
+update t1 set s1=0x1234 where a=1;
+select hex(s1) from t2;
+hex(s1)
+41
+update t1 set s1=0x12 where a=2;
+select hex(s1) from t2;
+hex(s1)
+12
+delete from t1 where a=1;
+delete from t1 where a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+select a,hex(s1) from t1;
+a	hex(s1)
+2	12
+select hex(s1) from t2;
+hex(s1)
+12
+drop table t2,t1;
+CREATE TABLE t1 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind)	hex(string1)
+31	
+32	
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind)	hex(string1)
+0031	
+0032	
+drop table t1,t2;
+CREATE TABLE t1 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind)	hex(string1)
+31	
+32	
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind)	hex(string1)
+0031	
+0032	
+drop table t1,t2;
+CREATE TABLE t1 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+hex(ind)	hex(string1)
+0	
+1	
+select hex(ind),hex(string1) from t2 order by string1;
+hex(ind)	hex(string1)
+0	
+1	
+drop table t1,t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set utf8 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set ucs2 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a	hex(b)
+1	61626364656667
+2	6465666768696A6B
+6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a	hex(b)
+1	61626364656667
+2	6465666768696A6B
+6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;

--- 1.43/mysql-test/r/type_float.result	2005-12-02 06:01:37 -05:00
+++ 1.44/mysql-test/r/type_float.result	2006-01-30 08:27:36 -05:00
@@ -240,6 +240,28 @@
   `d` double(22,9) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1, t2, t3;
+create table t1 select  105213674794682365.00 + 0.0 x;
+show warnings;
+Level	Code	Message
+desc  t1;
+Field	Type	Null	Key	Default	Extra
+x	decimal(21,2) unsigned	NO		0.00	
+drop table t1;
+create table t1 select 0.0 x;
+desc t1;
+Field	Type	Null	Key	Default	Extra
+x	decimal(2,1) unsigned	NO		0.0	
+create table t2 select 105213674794682365.00 y;
+desc t2;
+Field	Type	Null	Key	Default	Extra
+y	decimal(20,2) unsigned	NO		0.00	
+create table t3 select x+y a from t1,t2;
+show warnings;
+Level	Code	Message
+desc t3;
+Field	Type	Null	Key	Default	Extra
+a	decimal(21,2) unsigned	NO		0.00	
+drop table t1,t2,t3;
 create table t1 (s1 float(0,2));
 ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
 create table t1 (s1 float(1,2));

--- 1.77/mysql-test/r/variables.result	2005-11-23 15:47:25 -05:00
+++ 1.78/mysql-test/r/variables.result	2006-01-30 08:27:36 -05:00
@@ -537,10 +537,10 @@
 create table t1 (a int);
 select a into @x from t1;
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 show warnings;
 Level	Code	Message
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 drop table t1;
 set @@warning_count=1;
 ERROR HY000: Variable 'warning_count' is a read only variable

--- 1.45/mysql-test/t/alter_table.test	2005-12-30 23:49:41 -05:00
+++ 1.46/mysql-test/t/alter_table.test	2006-01-30 08:46:31 -05:00
@@ -274,7 +274,7 @@
 #
 set names koi8r;
 create table t1 (a char(10) character set koi8r);
+insert into t1 values ('ÔÅÓÔ');
 select a,hex(a) from t1;
 alter table t1 change a a char(10) character set cp1251;
 select a,hex(a) from t1;
@@ -354,7 +354,7 @@
 # modified. In other words, the values were reinterpreted
 # as UTF8 instead of being converted.
 create table t1 (a text) character set koi8r;
+insert into t1 values (_koi8r'ÔÅÓÔ');
 select hex(a) from t1;
 alter table t1 convert to character set cp1251;
 select hex(a) from t1;
@@ -414,6 +414,15 @@
 drop table t1;
 
 #
+# Bug#6073 "ALTER table minor glich": ALTER TABLE complains that an index
+# without # prefix is not allowed for TEXT columns, while index
+# is defined with prefix.
+# 
+create table t1 (t varchar(255) default null, key t (t(80)))
+engine=myisam default charset=latin1;
+alter table t1 change t t text;
+drop table t1;
+
 # Some additional tests for new, faster alter table.  Note that most of the
 # whole alter table code is being tested all around the test suite already.
 #

--- 1.123/mysql-test/t/innodb.test	2006-01-04 05:18:53 -05:00
+++ 1.124/mysql-test/t/innodb.test	2006-01-30 08:27:36 -05:00
@@ -1273,7 +1273,7 @@
 
 # Test for innodb_thread_concurrency variable
 show variables like "innodb_thread_concurrency";
-set global innodb_thread_concurrency=1000;
+set global innodb_thread_concurrency=1001;
 show variables like "innodb_thread_concurrency";
 set global innodb_thread_concurrency=0;
 show variables like "innodb_thread_concurrency";
@@ -1610,6 +1610,10 @@
 insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
 insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
 drop table t1;
 drop table t2;
 
@@ -1639,6 +1643,10 @@
 insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
 insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
 drop table t1;
 drop table t2;
 
@@ -1668,6 +1676,10 @@
 insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
 insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
 drop table t1;
 drop table t2;
 
@@ -1693,10 +1705,15 @@
 insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
 insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
 insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
 drop table t1;
 drop table t2;
 commit;
 
+
 #
 # Test that we can create a large (>1K) key
 #
@@ -1714,4 +1731,166 @@
                  e varchar(255) character set utf8,
                  key (a,b,c,d,e)) engine=innodb;
 
---echo End of 5.0 tests
+
+# test the padding of BINARY types and collations (Bug #14189)
+
+create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
+create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
+create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
+create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
+
+insert into t1 values (0x41),(0x4120),(0x4100);
+-- error 1062
+insert into t2 values (0x41),(0x4120),(0x4100);
+insert into t2 values (0x41),(0x4120);
+-- error 1062
+insert into t3 values (0x41),(0x4120),(0x4100);
+insert into t3 values (0x41),(0x4100);
+-- error 1062
+insert into t4 values (0x41),(0x4120),(0x4100);
+insert into t4 values (0x41),(0x4100);
+select hex(s1) from t1;
+select hex(s1) from t2;
+select hex(s1) from t3;
+select hex(s1) from t4;
+drop table t1,t2,t3,t4;
+
+create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
+create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+
+insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
+-- error 1452
+insert into t2 values(0x42);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x123456 where a=2;
+select hex(s1) from t2;
+-- error 1451
+update t1 set s1=0x12 where a=1;
+-- error 1451
+update t1 set s1=0x12345678 where a=1;
+-- error 1451
+update t1 set s1=0x123457 where a=1;
+update t1 set s1=0x1220 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x1200 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x4200 where a=1;
+select hex(s1) from t2;
+-- error 1451
+delete from t1 where a=1;
+delete from t1 where a=2;
+update t2 set s1=0x4120;
+-- error 1451
+delete from t1;
+delete from t1 where a!=3;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+
+create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
+create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+
+insert into t1 values(1,0x4100),(2,0x41);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x1234 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x12 where a=2;
+select hex(s1) from t2;
+delete from t1 where a=1;
+-- error 1451
+delete from t1 where a=2;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+#
+# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
+#
+CREATE TABLE t1 (
+  ind enum('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+  ind enum('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+  ind set('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+  ind set('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+  ind bit not null,
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+  ind bit not null,
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+select hex(ind),hex(string1) from t2 order by string1;
+drop table t1,t2;
+
+# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
+
+create table t2 (
+  a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set utf8 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+  a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set ucs2 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;

--- 1.115/sql/ha_innodb.h	2006-01-07 08:41:40 -05:00
+++ 1.116/sql/ha_innodb.h	2006-01-30 08:27:37 -05:00
@@ -214,7 +214,6 @@
 
 extern SHOW_VAR innodb_status_variables[];
 extern uint innobase_init_flags, innobase_lock_type;
-extern uint innobase_flush_log_at_trx_commit;
 extern ulong innobase_cache_size, innobase_fast_shutdown;
 extern ulong innobase_large_page_size;
 extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
@@ -252,6 +251,7 @@
 extern ulong srv_thread_sleep_delay;
 extern ulong srv_thread_concurrency;
 extern ulong srv_commit_concurrency;
+extern ulong srv_flush_log_at_trx_commit;
 }
 
 extern TYPELIB innobase_lock_typelib;

--- 1.161/sql/set_var.cc	2006-01-25 22:54:37 -05:00
+++ 1.162/sql/set_var.cc	2006-01-30 08:46:31 -05:00
@@ -475,6 +475,10 @@
                                                 &srv_thread_concurrency);
 sys_var_long_ptr  sys_innodb_commit_concurrency("innodb_commit_concurrency",
                                                 &srv_commit_concurrency);
+sys_var_long_ptr  sys_innodb_flush_log_at_trx_commit(
+                                        "innodb_flush_log_at_trx_commit",
+                                        &srv_flush_log_at_trx_commit);
+#endif
 
 /* Condition pushdown to storage engine */
 sys_var_thd_bool
@@ -615,71 +619,202 @@
 /* Read only variables */
 
 sys_var_const_str		sys_os("version_compile_os", SYSTEM_TYPE);
-sys_var_have_variable sys_have_archive_db("have_archive", &have_archive_db);
-sys_var_have_variable sys_have_berkeley_db("have_bdb", &have_berkeley_db);
-sys_var_have_variable sys_have_blackhole_db("have_blackhole_engine",
-                                            &have_blackhole_db);
-sys_var_have_variable sys_have_compress("have_compress", &have_compress);
-sys_var_have_variable sys_have_crypt("have_crypt", &have_crypt);
-sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db);
-sys_var_have_variable sys_have_example_db("have_example_engine",
-                                          &have_example_db);
-sys_var_have_variable sys_have_federated_db("have_federated_engine",
-                                            &have_federated_db);
-sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry);
-sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb);
-sys_var_have_variable sys_have_isam("have_isam", &have_isam);
-sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster);
-sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl);
-sys_var_have_variable sys_have_partition_db("have_partitioning",
-                                            &have_partition_db);
-sys_var_have_variable sys_have_query_cache("have_query_cache",
-                                           &have_query_cache);
-sys_var_have_variable sys_have_raid("have_raid", &have_raid);
-sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys);
-sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink);
-sys_var_have_variable sys_have_row_based_replication("have_row_based_replication",&have_row_based_replication);
+sys_var_readonly                sys_have_innodb("have_innodb", OPT_GLOBAL,
+                                                SHOW_CHAR, get_have_innodb);
 /* Global read-only variable describing server license */
 sys_var_const_str		sys_license("license", STRINGIFY_ARG(LICENSE));
 
-#ifdef HAVE_REPLICATION
-static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff)
+
+/*
+  List of all variables for initialisation and storage in hash
+  This is sorted in alphabetical order to make it easy to add new variables
+
+  If the variable is not in this list, it can't be changed with
+  SET variable_name=
+*/
+
+sys_var *sys_variables[]=
 {
-  var->type=SHOW_CHAR;
-  var->value= buff;
-  if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
-  {
-    var->value= "OFF";
-  }
-  else if (bitmap_is_set_all(&slave_error_mask))
-  {
-    var->value= "ALL";
-  }
-  else
-  {
-    /* 10 is enough assuming errors are max 4 digits */
-    int i;
-    var->value= buff;
-    for (i= 1;
-         i < MAX_SLAVE_ERROR &&
-         (buff - var->value) < SHOW_VAR_FUNC_BUFF_SIZE;
-         i++)
-    {
-      if (bitmap_is_set(&slave_error_mask, i))
-      {
-        buff= int10_to_str(i, buff, 10);
-        *buff++= ',';
-      }
-    }
-    if (var->value != buff)
-      buff--;				// Remove last ','
-    if (i < MAX_SLAVE_ERROR)
-      buff= strmov(buff, "...");  // Couldn't show all errors
-    *buff=0;
-  }
-  return 0;
-}
-#endif /* HAVE_REPLICATION */
+  &sys_auto_is_null,
+  &sys_auto_increment_increment,
+  &sys_auto_increment_offset,
+  &sys_autocommit,
+  &sys_automatic_sp_privileges,
+  &sys_big_tables,
+  &sys_big_selects,
+  &sys_binlog_cache_size,
+  &sys_buffer_results,
+  &sys_bulk_insert_buff_size,
+  &sys_character_set_server,
+  &sys_character_set_database,
+  &sys_character_set_client,
+  &sys_character_set_connection,
+  &sys_character_set_results,
+  &sys_charset_system,
+  &sys_collation_connection,
+  &sys_collation_database,
+  &sys_collation_server,
+  &sys_completion_type,
+  &sys_concurrent_insert,
+  &sys_connect_timeout,
+  &sys_date_format,
+  &sys_datetime_format,
+  &sys_div_precincrement,
+  &sys_default_week_format,
+  &sys_delay_key_write,
+  &sys_delayed_insert_limit,
+  &sys_delayed_insert_timeout,
+  &sys_delayed_queue_size,
+  &sys_error_count,
+  &sys_expire_logs_days,
+  &sys_flush,
+  &sys_flush_time,
+  &sys_ft_boolean_syntax,
+  &sys_foreign_key_checks,
+  &sys_group_concat_max_len,
+  &sys_have_innodb,
+  &sys_identity,
+  &sys_init_connect,
+  &sys_init_slave,
+  &sys_insert_id,
+  &sys_interactive_timeout,
+  &sys_join_buffer_size,
+  &sys_key_buffer_size,
+  &sys_key_cache_block_size,
+  &sys_key_cache_division_limit,
+  &sys_key_cache_age_threshold,
+  &sys_last_insert_id,
+  &sys_license,
+  &sys_local_infile,
+  &sys_log_binlog,
+  &sys_log_off,
+  &sys_log_update,
+  &sys_log_warnings,
+  &sys_long_query_time,
+  &sys_low_priority_updates,
+  &sys_max_allowed_packet,
+  &sys_max_binlog_cache_size,
+  &sys_max_binlog_size,
+  &sys_max_connect_errors,
+  &sys_max_connections,
+  &sys_max_delayed_threads,
+  &sys_max_error_count,
+  &sys_max_insert_delayed_threads,
+  &sys_max_heap_table_size,
+  &sys_max_join_size,
+  &sys_max_length_for_sort_data,
+  &sys_max_relay_log_size,
+  &sys_max_seeks_for_key,
+  &sys_max_sort_length,
+  &sys_max_sp_recursion_depth,
+  &sys_max_tmp_tables,
+  &sys_max_user_connections,
+  &sys_max_write_lock_count,
+  &sys_multi_range_count,
+  &sys_myisam_data_pointer_size,
+  &sys_myisam_max_sort_file_size,
+  &sys_myisam_repair_threads,
+  &sys_myisam_sort_buffer_size,
+  &sys_myisam_stats_method,
+  &sys_net_buffer_length,
+  &sys_net_read_timeout,
+  &sys_net_retry_count,
+  &sys_net_wait_timeout,
+  &sys_net_write_timeout,
+  &sys_new_mode,
+  &sys_old_passwords,
+  &sys_optimizer_prune_level,
+  &sys_optimizer_search_depth,
+  &sys_preload_buff_size,
+  &sys_pseudo_thread_id,
+  &sys_query_alloc_block_size,
+  &sys_query_cache_size,
+  &sys_query_prealloc_size,
+#ifdef HAVE_QUERY_CACHE
+  &sys_query_cache_limit,
+  &sys_query_cache_min_res_unit,
+  &sys_query_cache_type,
+  &sys_query_cache_wlock_invalidate,
+#endif /* HAVE_QUERY_CACHE */
+  &sys_quote_show_create,
+  &sys_rand_seed1,
+  &sys_rand_seed2,
+  &sys_range_alloc_block_size,
+  &sys_readonly,
+  &sys_read_buff_size,
+  &sys_read_rnd_buff_size,
+#ifdef HAVE_REPLICATION
+  &sys_relay_log_purge,
+#endif
+  &sys_rpl_recovery_rank,
+  &sys_safe_updates,
+  &sys_secure_auth,
+  &sys_select_limit,
+  &sys_server_id,
+#ifdef HAVE_REPLICATION
+  &sys_slave_compressed_protocol,
+  &sys_slave_net_timeout,
+  &sys_slave_trans_retries,
+  &sys_slave_skip_counter,
+#endif
+  &sys_slow_launch_time,
+  &sys_sort_buffer,
+  &sys_sql_big_tables,
+  &sys_sql_low_priority_updates,
+  &sys_sql_max_join_size,
+  &sys_sql_mode,
+  &sys_sql_warnings,
+  &sys_sql_notes,
+  &sys_storage_engine,
+#ifdef HAVE_REPLICATION
+  &sys_sync_binlog_period,
+  &sys_sync_replication,
+  &sys_sync_replication_slave_id,
+  &sys_sync_replication_timeout,
+#endif
+  &sys_sync_frm,
+  &sys_table_cache_size,
+  &sys_table_lock_wait_timeout,
+  &sys_table_type,
+  &sys_thread_cache_size,
+  &sys_time_format,
+  &sys_timed_mutexes,
+  &sys_timestamp,
+  &sys_time_zone,
+  &sys_tmp_table_size,
+  &sys_trans_alloc_block_size,
+  &sys_trans_prealloc_size,
+  &sys_tx_isolation,
+  &sys_os,
+#ifdef HAVE_INNOBASE_DB
+  &sys_innodb_fast_shutdown,
+  &sys_innodb_max_dirty_pages_pct,
+  &sys_innodb_max_purge_lag,
+  &sys_innodb_table_locks,
+  &sys_innodb_support_xa,
+  &sys_innodb_max_purge_lag,
+  &sys_innodb_autoextend_increment,
+  &sys_innodb_sync_spin_loops,
+  &sys_innodb_concurrency_tickets,
+  &sys_innodb_thread_sleep_delay,
+  &sys_innodb_thread_concurrency,
+  &sys_innodb_commit_concurrency,
+  &sys_innodb_flush_log_at_trx_commit,
+#endif  
+  &sys_trust_routine_creators,
+  &sys_trust_function_creators,
+  &sys_engine_condition_pushdown,
+#ifdef HAVE_NDBCLUSTER_DB
+  &sys_ndb_autoincrement_prefetch_sz,
+  &sys_ndb_cache_check_time,
+  &sys_ndb_force_send,
+  &sys_ndb_use_exact_count,
+  &sys_ndb_use_transactions,
+#endif
+  &sys_unique_checks,
+  &sys_updatable_views_with_limit,
+  &sys_warning_count
+};
 
 
 /*
@@ -774,7 +909,6 @@
   {sys_innodb_fast_shutdown.name,(char*) &sys_innodb_fast_shutdown, SHOW_SYS},
   {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
   {"innodb_file_per_table", (char*) &innobase_file_per_table, SHOW_MY_BOOL},
-  {"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_INT},
   {"innodb_flush_method",    (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
   {"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
   {"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
@@ -794,6 +928,8 @@
   {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
   {sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS},
   {sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS},
+  {sys_innodb_flush_log_at_trx_commit.name, (char*) &sys_innodb_flush_log_at_trx_commit, SHOW_SYS},
+#endif
   {sys_interactive_timeout.name,(char*) &sys_interactive_timeout,   SHOW_SYS},
   {sys_join_buffer_size.name,   (char*) &sys_join_buffer_size,	    SHOW_SYS},
   {sys_key_buffer_size.name,	(char*) &sys_key_buffer_size,	    SHOW_SYS},
@@ -2495,7 +2631,6 @@
 
 bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
 {
-  pthread_mutex_t *lock_log= mysql_bin_log.get_log_lock();
   sync_binlog_period= (ulong) var->save_result.ulonglong_value;
   return 0;
 }

--- 1.174/client/mysqltest.c	2006-01-13 11:44:28 -05:00
+++ 1.175/client/mysqltest.c	2006-01-30 08:27:35 -05:00
@@ -2255,19 +2255,8 @@
     *create_conn= 0;
     goto err;
   }
-  else
-  {
-    handle_no_error(q);
 
-    /*
-      Fail if there was no error but we expected it.
-      We also don't want to have connection in this case.
-    */
-    mysql_close(con);
-    *create_conn= 0;
-    error= 1;
-    goto err;
-  }
+  handle_no_error(q);
 
   /*
    TODO: change this to 0 in future versions, but the 'kill' test relies on

--- 1.100/mysql-test/r/sp-error.result	2006-01-19 05:48:01 -05:00
+++ 1.101/mysql-test/r/sp-error.result	2006-01-30 08:27:36 -05:00
@@ -464,19 +464,6 @@
 call bug3294()|
 ERROR 42S02: Unknown table 't5'
 drop procedure bug3294|
-drop procedure if exists bug6807|
-create procedure bug6807()
-begin
-declare id int;
-set id = connection_id();
-kill query id;
-select 'Not reached';
-end|
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-call bug6807()|
-ERROR 70100: Query execution was interrupted
-drop procedure bug6807|
 drop procedure if exists bug8776_1|
 drop procedure if exists bug8776_2|
 drop procedure if exists bug8776_3|

--- 1.180/mysql-test/r/sp.result	2006-01-19 04:28:59 -05:00
+++ 1.181/mysql-test/r/sp.result	2006-01-30 08:27:36 -05:00
@@ -522,7 +522,7 @@
 create table t3 ( s char(16), d int)|
 call into_test4()|
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 select * from t3|
 s	d
 into4	NULL
@@ -1178,8 +1178,8 @@
 delete from t1 |
 delete from t2 |
 drop table t4|
-drop table if exists fac|
-create table fac (n int unsigned not null primary key, f bigint unsigned)|
+drop table if exists t3|
+create table t3 (n int unsigned not null primary key, f bigint unsigned)|
 drop procedure if exists ifac|
 create procedure ifac(n int unsigned)
 begin
@@ -1189,13 +1189,13 @@
 end if;
 while i <= n do
 begin
-insert into test.fac values (i, fac(i));
+insert into test.t3 values (i, fac(i));
 set i = i + 1;
 end;
 end while;
 end|
 call ifac(20)|
-select * from fac|
+select * from t3|
 n	f
 1	1
 2	2
@@ -1217,7 +1217,7 @@
 18	6402373705728000
 19	121645100408832000
 20	2432902008176640000
-drop table fac|
+drop table t3|
 show function status like '%f%'|
 Db	Name	Type	Definer	Modified	Created	Security_type	Comment
 test	fac	FUNCTION	root@localhost	0000-00-00 00:00:00	0000-00-00 00:00:00	DEFINER	
@@ -1225,12 +1225,12 @@
 drop function fac|
 show function status like '%f%'|
 Db	Name	Type	Definer	Modified	Created	Security_type	Comment
-drop table if exists primes|
-create table primes (
+drop table if exists t3|
+create table t3 (
 i int unsigned not null primary key,
 p bigint unsigned not null
 )|
-insert into primes values
+insert into t3 values
 ( 0,   3), ( 1,   5), ( 2,   7), ( 3,  11), ( 4,  13),
 ( 5,  17), ( 6,  19), ( 7,  23), ( 8,  29), ( 9,  31),
 (10,  37), (11,  41), (12,  43), (13,  47), (14,  53),
@@ -1253,7 +1253,7 @@
 else
 begin
 declare p bigint unsigned;
-select t.p into p from test.primes t where t.i = s;
+select t.p into p from test.t3 t where t.i = s;
 if b+p > r then
 set pp = 1;
 leave again;
@@ -1278,7 +1278,7 @@
 declare pp bool default 0;
 call opp(p, pp);
 if pp then
-insert into test.primes values (i, p);
+insert into test.t3 values (i, p);
 set i = i+1;
 end if;
 set p = p+2;
@@ -1299,7 +1299,7 @@
 else
 begin
 declare p bigint unsigned;
-select t.p into p from test.primes t where t.i = s;
+select t.p into p from test.t3 t where t.i = s;
 if b+p > r then
 set pp = 1;
 leave again;
@@ -1318,47 +1318,47 @@
 test	ip	PROCEDURE	root@localhost	0000-00-00 00:00:00	0000-00-00 00:00:00	DEFINER	
 test	opp	PROCEDURE	root@localhost	0000-00-00 00:00:00	0000-00-00 00:00:00	DEFINER	
 call ip(200)|
-select * from primes where i=45 or i=100 or i=199|
+select * from t3 where i=45 or i=100 or i=199|
 i	p
 45	211
 100	557
 199	1229
-drop table primes|
+drop table t3|
 drop procedure opp|
 drop procedure ip|
 show procedure status like '%p%'|
 Db	Name	Type	Definer	Modified	Created	Security_type	Comment
-drop table if exists fib|
-create table fib ( f bigint unsigned not null )|
+drop table if exists t3|
+create table t3 ( f bigint unsigned not null )|
 drop procedure if exists fib|
 create procedure fib(n int unsigned)
 begin
 if n > 1 then
 begin
 declare x, y bigint unsigned;
-declare c cursor for select f from fib order by f desc limit 2;
+declare c cursor for select f from t3 order by f desc limit 2;
 open c;
 fetch c into y;
 fetch c into x;
 close c;
-insert into fib values (x+y);
+insert into t3 values (x+y);
 call fib(n-1);
 end;
 end if;
 end|
 set @@max_sp_recursion_depth= 20|
-insert into fib values (0), (1)|
+insert into t3 values (0), (1)|
 call fib(3)|
-select * from fib order by f asc|
+select * from t3 order by f asc|
 f
 0
 1
 1
 2
-delete from fib|
-insert into fib values (0), (1)|
-call fib(20)|
-select * from fib order by f asc|
+delete from t3|
+insert into t3 values (0), (1)|
+call fib(10)|
+select * from t3 order by f asc|
 f
 0
 1
@@ -1371,17 +1371,7 @@
 21
 34
 55
-89
-144
-233
-377
-610
-987
-1597
-2584
-4181
-6765
-drop table fib|
+drop table t3|
 drop procedure fib|
 set @@max_sp_recursion_depth= 0|
 drop procedure if exists bar|
@@ -1787,10 +1777,10 @@
 call bug1863(10)|
 Warnings:
 Note	1051	Unknown table 'temp_t1'
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 call bug1863(10)|
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 select * from t4|
 f1	rc	t3
 2	0	NULL
@@ -2084,10 +2074,10 @@
 call bug4579_1()|
 call bug4579_1()|
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 call bug4579_1()|
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 drop procedure bug4579_1|
 drop procedure bug4579_2|
 drop table t3|
@@ -2505,7 +2495,7 @@
 var
 NULL
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 call bug7743("anotherword")|
 var
 2
@@ -2513,7 +2503,7 @@
 var
 NULL
 Warnings:
-Warning	1329	No data to FETCH
+Warning	1329	No data - zero rows fetched, selected, or processed
 drop procedure bug7743|
 drop table t4|
 delete from t3|
@@ -3552,8 +3542,6 @@
 drop procedure if exists bug7049_2|
 drop procedure if exists bug7049_3|
 drop procedure if exists bug7049_4|
-drop procedure if exists bug7049_5|
-drop procedure if exists bug7049_6|
 drop function if exists bug7049_1|
 drop function if exists bug7049_2|
 create table t3 ( x int unique )|
@@ -3578,18 +3566,6 @@
 call bug7049_3();
 select 'Missed it' as 'Result';
 end|
-create procedure bug7049_5()
-begin
-declare x decimal(2,1);
-set x = 'zap';
-end|
-create procedure bug7049_6()
-begin
-declare exit handler for sqlwarning
-select 'Caught it' as 'Result';
-call bug7049_5();
-select 'Missed it' as 'Result';
-end|
 create function bug7049_1()
 returns int
 begin
@@ -3619,9 +3595,6 @@
 select * from t3|
 x
 42
-call bug7049_6()|
-Result
-Caught it
 select bug7049_2()|
 bug7049_2()
 1
@@ -3630,8 +3603,6 @@
 drop procedure bug7049_2|
 drop procedure bug7049_3|
 drop procedure bug7049_4|
-drop procedure bug7049_5|
-drop procedure bug7049_6|
 drop function bug7049_1|
 drop function bug7049_2|
 drop function if exists bug13941|
@@ -4313,4 +4284,143 @@
 2	NULL
 drop table t3|
 drop procedure bug15441|
+drop procedure if exists bug14498_1|
+drop procedure if exists bug14498_2|
+drop procedure if exists bug14498_3|
+drop procedure if exists bug14498_4|
+drop procedure if exists bug14498_5|
+create procedure bug14498_1()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+if v then
+select 'yes' as 'v';
+else
+select 'no' as 'v';
+end if;
+select 'done' as 'End';
+end|
+create procedure bug14498_2()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+while v do
+select 'yes' as 'v';
+end while;
+select 'done' as 'End';
+end|
+create procedure bug14498_3()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+repeat
+select 'maybe' as 'v';
+until v end repeat;
+select 'done' as 'End';
+end|
+create procedure bug14498_4()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+case v
+when 1 then
+select '1' as 'v';
+when 2 then
+select '2' as 'v';
+else
+select '?' as 'v';
+end case;
+select 'done' as 'End';
+end|
+create procedure bug14498_5()
+begin
+declare continue handler for sqlexception select 'error' as 'Handler';
+case
+when v = 1 then
+select '1' as 'v';
+when v = 2 then
+select '2' as 'v';
+else
+select '?' as 'v';
+end case;
+select 'done' as 'End';
+end|
+call bug14498_1()|
+Handler
+error
+End
+done
+call bug14498_2()|
+Handler
+error
+End
+done
+call bug14498_3()|
+v
+maybe
+Handler
+error
+End
+done
+call bug14498_5()|
+Handler
+error
+End
+done
+drop procedure bug14498_1|
+drop procedure bug14498_2|
+drop procedure bug14498_3|
+drop procedure bug14498_4|
+drop procedure bug14498_5|
+drop table if exists t3|
+drop procedure if exists bug15231_1|
+drop procedure if exists bug15231_2|
+drop procedure if exists bug15231_3|
+drop procedure if exists bug15231_4|
+create table t3 (id int not null)|
+create procedure bug15231_1()
+begin
+declare xid integer;
+declare xdone integer default 0;
+declare continue handler for not found set xdone = 1;
+set xid=null;
+call bug15231_2(xid);
+select xid, xdone;
+end|
+create procedure bug15231_2(inout ioid integer)
+begin
+select "Before NOT FOUND condition is triggered" as '1';
+select id into ioid from t3 where id=ioid;
+select "After NOT FOUND condtition is triggered" as '2';
+if ioid is null then
+set ioid=1;
+end if;
+end|
+create procedure bug15231_3()
+begin
+declare exit handler for sqlwarning
+select 'Caught it (wrong)' as 'Result';
+call bug15231_4();
+end|
+create procedure bug15231_4()
+begin
+declare x decimal(2,1);
+set x = 'zap';
+select 'Missed it (correct)' as 'Result';
+end|
+call bug15231_1()|
+1
+Before NOT FOUND condition is triggered
+2
+After NOT FOUND condtition is triggered
+xid	xdone
+1	0
+Warnings:
+Warning	1329	No data - zero rows fetched, selected, or processed
+call bug15231_3()|
+Result
+Missed it (correct)
+Warnings:
+Warning	1366	Incorrect decimal value: 'zap' for column 'x' at row 1
+drop table if exists t3|
+drop procedure if exists bug15231_1|
+drop procedure if exists bug15231_2|
+drop procedure if exists bug15231_3|
+drop procedure if exists bug15231_4|
 drop table t1,t2;

--- 1.101/mysql-test/t/sp-error.test	2006-01-04 05:18:54 -05:00
+++ 1.102/mysql-test/t/sp-error.test	2006-01-30 08:27:36 -05:00
@@ -1534,6 +1534,7 @@
 drop function bug13012_2|
 delimiter ;|
 
+#
 # BUG#11555 "Stored procedures: current SP tables locking make 
 # impossible view security". We should not expose names of tables
 # which are implicitly used by view (via stored routines/triggers).
@@ -1594,7 +1595,33 @@
 drop table t1;
 drop view v1;
 
+#
+# BUG#15658: Server crashes after creating function as empty string
+#
+--disable_warnings
+drop procedure if exists ` bug15658`;
+--enable_warnings
 
+--error ER_SP_WRONG_NAME
+create procedure ``() select 1;
+--error ER_SP_WRONG_NAME
+create procedure ` `() select 1;
+--error ER_SP_WRONG_NAME
+create procedure `bug15658 `() select 1;
+--error ER_WRONG_DB_NAME
+create procedure ``.bug15658() select 1;
+--error ER_WRONG_DB_NAME
+create procedure `x `.bug15658() select 1;
+
+# This should work
+create procedure ` bug15658`() select 1;
+call ` bug15658`();
+--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+show procedure status;
+drop procedure ` bug15658`;
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings

--- 1.172/mysql-test/t/sp.test	2006-01-20 02:32:18 -05:00
+++ 1.173/mysql-test/t/sp.test	2006-01-30 08:27:36 -05:00
@@ -1444,11 +1444,11 @@
 call ifac(20)|
 select * from t3|
 drop table t3|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show function status like '%f%'|
 drop procedure ifac|
 drop function fac|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show function status like '%f%'|
 
 
@@ -1531,7 +1531,7 @@
   end while;
 end|
 show create procedure opp|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like '%p%'|
 
 # This isn't the fastest way in the world to compute prime numbers, so
@@ -1549,7 +1549,7 @@
 drop table t3|
 drop procedure opp|
 drop procedure ip|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like '%p%'|
 
 
@@ -1618,13 +1618,13 @@
 create procedure bar(x char(16), y int)
  comment "111111111111" sql security invoker
  insert into test.t1 values (x, y)|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like 'bar'|
 alter procedure bar comment "2222222222" sql security definer|
 alter procedure bar comment "3333333333"|
 alter procedure bar|
 show create procedure bar|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 show procedure status like 'bar'|
 drop procedure bar|
 
@@ -2574,7 +2574,6 @@
   show databases like 'foo';
   show errors;
   show columns from t1;
-  show grants for 'root'@'localhost';
   show keys from t1;
   show open tables like 'foo';
   show privileges;
@@ -2596,20 +2595,6 @@
 
 drop procedure bug4902|
 
-# We need separate SP for SHOW PROCESSLIST  since we want use replace_column
---disable_warnings
-drop procedure if exists bug4902_2|
---enable_warnings
-create procedure bug4902_2()
-begin
-  show processlist;
-end|
---replace_column 1 # 6 # 3 localhost
-call bug4902_2()|
---replace_column 1 # 6 # 3 localhost
-call bug4902_2()|
-drop procedure bug4902_2|
-
 #
 # BUG#4904
 #
@@ -2824,44 +2809,6 @@
 delete from t1|
 drop procedure bug4941|
 
-
-#
-# BUG#3583: query cache doesn't work for stored procedures
-#
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
-create procedure bug3583()
-begin
-  declare c int;
-
-  select * from t1;
-  select count(*) into c from t1;
-  select c;
-end|
-
-insert into t1 values ("x", 3), ("y", 5)|
-set @x = @@query_cache_size|
-set global query_cache_size = 10*1024*1024|
-
-flush status|
-flush query cache|
-show status like 'Qcache_hits'|
-call bug3583()|
-show status like 'Qcache_hits'|
-call bug3583()|
-call bug3583()|
-show status like 'Qcache_hits'|
-
-set global query_cache_size = @x|
-flush status|
-flush query cache|
-delete from t1|
-drop procedure bug3583|
-
 #
 # BUG#4905: Stored procedure doesn't clear for "Rows affected"
 #
@@ -3171,24 +3118,6 @@
 drop function bug5240|
 
 #
-# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
-#
---disable_warnings
-drop function if exists bug5278|
---enable_warnings
-create function bug5278 () returns char
-begin
-  SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
-  return 'okay';
-end|
-
---error 1133
-select bug5278()|
---error 1133
-select bug5278()|
-drop function bug5278|
-
-#
 # BUG#7992: rolling back temporary Item tree changes in SP
 #
 --disable_warnings
@@ -4209,9 +4138,13 @@
 --error 1062
 select bug12379()|
 select 1|
+# statement-based binlogging will show warning which row-based won't;
+# so we hide it (this warning is already tested in rpl_stm_sp.test)
+--disable_warnings
 call bug12379_1()|
 select 2|
 call bug12379_2()|
+--enable_warnings
 select 3|
 --error 1062
 call bug12379_3()|
@@ -4785,24 +4718,6 @@
 call bug10100t(5)|
 
 #end of the stack checking
-set @@max_sp_recursion_depth=255|
-set @var=1|
-#disable log because error about stack overrun contains numbers which
-#depend on a system
--- disable_result_log
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100p(255, @var)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pt(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pv(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pd(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pc(1,255)|
--- enable_result_log
-set @@max_sp_recursion_depth=0|
-
 deallocate prepare stmt2|
 
 drop function bug10100f|

--- 1.198/sql/sp_head.cc	2006-01-20 07:59:18 -05:00
+++ 1.199/sql/sp_head.cc	2006-01-30 08:27:38 -05:00
@@ -180,11 +180,11 @@
   case SQLCOM_SHOW_ERRORS:
   case SQLCOM_SHOW_FIELDS:
   case SQLCOM_SHOW_GRANTS:
-  case SQLCOM_SHOW_INNODB_STATUS:
+  case SQLCOM_SHOW_ENGINE_STATUS:
+  case SQLCOM_SHOW_ENGINE_LOGS:
+  case SQLCOM_SHOW_ENGINE_MUTEX:
   case SQLCOM_SHOW_KEYS:
-  case SQLCOM_SHOW_LOGS:
   case SQLCOM_SHOW_MASTER_STAT:
-  case SQLCOM_SHOW_MUTEX_STATUS:
   case SQLCOM_SHOW_NEW_MASTER:
   case SQLCOM_SHOW_OPEN_TABLES:
   case SQLCOM_SHOW_PRIVILEGES:
@@ -314,6 +314,9 @@
 {
   DBUG_ENTER("sp_eval_expr");
 
+  if (!expr_item)
+    DBUG_RETURN(TRUE);
+
   if (!(expr_item= sp_prepare_func_item(thd, &expr_item)))
     DBUG_RETURN(TRUE);
 
@@ -497,7 +500,7 @@
 sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
 {
   DBUG_ENTER("sp_head::init_strings");
-  uchar *endp;                  /* Used to trim the end */
+  const uchar *endp;                            /* Used to trim the end */
   /* During parsing, we must use thd->mem_root */
   MEM_ROOT *root= thd->mem_root;
 
@@ -698,7 +701,8 @@
   field_length= !m_return_field_def.length ?
                 field_max_length : m_return_field_def.length;
 
-  field= ::make_field((char*) 0,                    /* field ptr */
+  field= ::make_field(table->s,                     /* TABLE_SHARE ptr */
+                      (char*) 0,                    /* field ptr */
                       field_length,                 /* field [max] length */
                       (uchar*) "",                  /* null ptr */
                       0,                            /* null bit */
@@ -708,8 +712,10 @@
                       m_return_field_def.geom_type,
                       Field::NONE,                  /* unreg check */
                       m_return_field_def.interval,
-                      field_name ? field_name : (const char *) m_name.str,
-                      table);
+                      field_name ? field_name : (const char *) m_name.str);
+
+  if (field)
+    field->init(table);
   
   DBUG_RETURN(field);
 }
@@ -723,6 +729,9 @@
 
 /*
   StoredRoutinesBinlogging
+  This paragraph applies only to statement-based binlogging. Row-based
+  binlogging does not need anything special like this.
+
   Top-down overview:
 
   1. Statements
@@ -1290,56 +1299,62 @@
 
   thd->spcont= nctx;
 
-  binlog_save_options= thd->options;
-  need_binlog_call= mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG);
+  /*
+    If row-based binlogging, we don't need to binlog the function's call, let
+    each substatement be binlogged its way.
+  */
+  need_binlog_call= mysql_bin_log.is_open() &&
+    (thd->options & OPTION_BIN_LOG) && !binlog_row_based;
   if (need_binlog_call)
   {
     reset_dynamic(&thd->user_var_events);
     mysql_bin_log.start_union_events(thd);
+    binlog_save_options= thd->options;
+    thd->options&= ~OPTION_BIN_LOG;
   }
-    
-  thd->options&= ~OPTION_BIN_LOG;
+
   err_status= execute(thd);
-  thd->options= binlog_save_options;
-  
-  if (need_binlog_call)
-    mysql_bin_log.stop_union_events(thd);
 
-  if (need_binlog_call && thd->binlog_evt_union.unioned_events)
+  if (need_binlog_call)
   {
-    char buf[256];
-    String bufstr(buf, sizeof(buf), &my_charset_bin);
-    bufstr.length(0);
-    bufstr.append(STRING_WITH_LEN("DO "));
-    append_identifier(thd, &bufstr, m_name.str, m_name.length);
-    bufstr.append('(');
-    for (uint i=0; i < argcount; i++)
+    mysql_bin_log.stop_union_events(thd);
+    thd->options= binlog_save_options;
+    if (thd->binlog_evt_union.unioned_events)
     {
-      String str_value_holder;
-      String *str_value;
-
-      if (i)
-        bufstr.append(',');
-
-      str_value= sp_get_item_value(param_values[i], &str_value_holder);
+      char buf[256];
+      String bufstr(buf, sizeof(buf), &my_charset_bin);
+      bufstr.length(0);
+      bufstr.append(STRING_WITH_LEN("DO "));
+      append_identifier(thd, &bufstr, m_name.str, m_name.length);
+      bufstr.append('(');
+      for (uint i=0; i < argcount; i++)
+      {
+        String str_value_holder;
+        String *str_value;
 
-      if (str_value)
-        bufstr.append(*str_value);
-      else
-        bufstr.append(STRING_WITH_LEN("NULL"));
-    }
-    bufstr.append(')');
-    
-    Query_log_event qinfo(thd, bufstr.ptr(), bufstr.length(),
-                          thd->binlog_evt_union.unioned_events_trans, FALSE);
-    if (mysql_bin_log.write(&qinfo) && 
-        thd->binlog_evt_union.unioned_events_trans)
-    {
-      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
-                   "Invoked ROUTINE modified a transactional table but MySQL "
-                   "failed to reflect this change in the binary log");
+        if (i)
+          bufstr.append(',');
+        
+        str_value= sp_get_item_value(param_values[i], &str_value_holder);
+
+        if (str_value)
+          bufstr.append(*str_value);
+        else
+          bufstr.append(STRING_WITH_LEN("NULL"));
+      }
+      bufstr.append(')');
+      
+      Query_log_event qinfo(thd, bufstr.ptr(), bufstr.length(),
+                            thd->binlog_evt_union.unioned_events_trans, FALSE);
+      if (mysql_bin_log.write(&qinfo) &&
+          thd->binlog_evt_union.unioned_events_trans)
+      {
+        push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+                     "Invoked ROUTINE modified a transactional table but MySQL "
+                     "failed to reflect this change in the binary log");
+      }
+      reset_dynamic(&thd->user_var_events);
     }
-    reset_dynamic(&thd->user_var_events);
   }
 
   if (m_type == TYPE_ENUM_FUNCTION && !err_status)

--- 1.77/sql/sp_head.h	2006-01-19 10:13:00 -05:00
+++ 1.78/sql/sp_head.h	2006-01-30 08:27:38 -05:00
@@ -132,8 +132,7 @@
 
   create_field m_return_field_def; /* This is used for FUNCTIONs only. */
 
-  uchar *m_tmp_query;		// Temporary pointer to sub query string
-  uint m_old_cmq;		// Old CLIENT_MULTI_QUERIES value
+  const uchar *m_tmp_query;	// Temporary pointer to sub query string
   st_sp_chistics *m_chistics;
   ulong m_sql_mode;		// For SHOW CREATE and execution
   LEX_STRING m_qname;		// db.name
@@ -181,7 +180,7 @@
   */
   HASH m_sroutines;
   // Pointers set during parsing
-  uchar *m_param_begin, *m_param_end, *m_body_begin;
+  const uchar *m_param_begin, *m_param_end, *m_body_begin;
 
   /*
     Security context for stored routine which should be run under

--- 1.93/sql/slave.h	2005-12-21 23:10:54 -05:00
+++ 1.94/sql/slave.h	2006-01-30 08:27:38 -05:00
@@ -231,7 +231,7 @@
 
 int init_slave();
 void init_slave_skip_errors(const char* arg);
-bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache);
+int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache);
 bool flush_relay_log_info(RELAY_LOG_INFO* rli);
 int register_slave_on_master(MYSQL* mysql);
 int terminate_slave_threads(MASTER_INFO* mi, int thread_mask,

--- 1.223/BitKeeper/etc/ignore	2006-01-13 11:04:07 -05:00
+++ 1.224/BitKeeper/etc/ignore	2006-01-30 08:27:20 -05:00
@@ -295,6 +295,7 @@
 libmysql/*.vcproj
 libmysql/conf_to_src
 libmysql/debug/libmysql.exp
+libmysql/libmysql.ver
 libmysql/my_static.h
 libmysql/my_time.c
 libmysql/mysys_priv.h

--- 1.62/sql/repl_failsafe.cc	2005-11-23 07:04:09 -05:00
+++ 1.63/sql/repl_failsafe.cc	2006-01-30 08:27:38 -05:00
@@ -930,7 +930,8 @@
           host was specified; there could have been a problem when replication
           started, which led to relay log's IO_CACHE to not be inited.
         */
-	flush_master_info(active_mi, 0);
+        if (flush_master_info(active_mi, 0))
+          sql_print_error("Failed to flush master info file");
       }
       mysql_free_result(master_status_res);
     }

--- 1.148/sql/sql_repl.cc	2006-01-12 13:50:32 -05:00
+++ 1.149/sql/sql_repl.cc	2006-01-30 08:46:31 -05:00
@@ -1201,7 +1201,12 @@
     Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
     a slave before).
   */
-  flush_master_info(mi, 0);
+  if (flush_master_info(mi, 0))
+  {
+    my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
+    unlock_slave_threads(mi);
+    DBUG_RETURN(TRUE);
+  }
   if (need_relay_log_purge)
   {
     relay_log_purge= 1;
@@ -1311,8 +1316,6 @@
   bool ret = TRUE;
   IO_CACHE log;
   File file = -1;
-  Format_description_log_event *description_event= new
-    Format_description_log_event(3); /* MySQL 4.0 by default */
 
   Log_event::init_show_field_list(&field_list);
   if (protocol->send_fields(&field_list,
@@ -1325,6 +1328,8 @@
     this is needed so that the uses sees all its own commands in the binlog
   */
   ha_binlog_wait(thd);
+  Format_description_log_event *description_event= new
+    Format_description_log_event(3); /* MySQL 4.0 by default */
 
   if (mysql_bin_log.is_open())
   {

--- 1.79/sql/sql_handler.cc	2006-01-16 08:26:27 -05:00
+++ 1.80/sql/sql_handler.cc	2006-01-30 08:27:39 -05:00
@@ -422,12 +422,13 @@
   if (!lock)
     goto err0; // mysql_lock_tables() printed error message already
 
-  if (cond && ((!cond->fixed &&
-                cond->fix_fields(thd, &cond)) || cond->check_cols(1)))
+  if (cond)
   {
     if (table->query_id != thd->query_id)
       cond->cleanup();                          // File was reopened
-    goto err0;
+    if ((!cond->fixed &&
+	 cond->fix_fields(thd, &cond)) || cond->check_cols(1))
+      goto err0;
   }
 
   if (keyname)

--- 1.159/sql/sql_prepare.cc	2006-01-19 04:29:00 -05:00
+++ 1.160/sql/sql_prepare.cc	2006-01-30 08:27:39 -05:00
@@ -2120,6 +2120,8 @@
       were closed in the end of previous prepare or execute call.
     */
     tables->table= 0;
+    /* Reset is_schema_table_processed value(needed for I_S tables */
+    tables->is_schema_table_processed= FALSE;
 
     if (tables->prep_on_expr)
     {

--- 1.168/tests/mysql_client_test.c	2005-12-18 12:02:37 -05:00
+++ 1.169/tests/mysql_client_test.c	2006-01-30 08:27:42 -05:00
@@ -14624,6 +14624,87 @@
   myquery(rc);
 }
 
+/* Bug #16144: mysql_stmt_attr_get type error */
+
+static void test_bug16144()
+{
+  const my_bool flag_orig= (my_bool) 0xde;
+  my_bool flag= flag_orig;
+  MYSQL_STMT *stmt;
+  myheader("test_bug16144");
+
+  /* Check that attr_get returns correct data on little and big endian CPUs */
+  stmt= mysql_stmt_init(mysql);
+  mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (const void*) &flag);
+  mysql_stmt_attr_get(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &flag);
+  DIE_UNLESS(flag == flag_orig);
+  mysql_stmt_close(stmt);
+}
+
+/*
+  Bug #15613: "libmysqlclient API function mysql_stmt_prepare returns wrong
+  field length"
+*/
+
+static void test_bug15613()
+{
+  MYSQL_STMT *stmt;
+  const char *stmt_text;
+  MYSQL_RES *metadata;
+  MYSQL_FIELD *field;
+  int rc;
+  myheader("test_bug15613");
+
+  /* I. Prepare the table */
+  rc= mysql_query(mysql, "set names latin1");
+  myquery(rc);
+  mysql_query(mysql, "drop table if exists t1");
+  rc= mysql_query(mysql,
+                  "create table t1 (t text character set utf8, "
+                                   "tt tinytext character set utf8, "
+                                   "mt mediumtext character set utf8, "
+                                   "lt longtext character set utf8, "
+                                   "vl varchar(255) character set latin1,"
+                                   "vb varchar(255) character set binary,"
+                                   "vu varchar(255) character set utf8)");
+  myquery(rc);
+
+  stmt= mysql_stmt_init(mysql);
+
+  /* II. Check SELECT metadata */
+  stmt_text= ("select t, tt, mt, lt, vl, vb, vu from t1");
+  rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+  metadata= mysql_stmt_result_metadata(stmt);
+  field= mysql_fetch_fields(metadata);
+  if (!opt_silent)
+  {
+    printf("Field lengths (client character set is latin1):\n"
+           "text character set utf8:\t\t%lu\n"
+           "tinytext character set utf8:\t\t%lu\n"
+           "mediumtext character set utf8:\t\t%lu\n"
+           "longtext character set utf8:\t\t%lu\n"
+           "varchar(255) character set latin1:\t%lu\n"
+           "varchar(255) character set binary:\t%lu\n"
+           "varchar(255) character set utf8:\t%lu\n",
+           field[0].length, field[1].length, field[2].length, field[3].length,
+           field[4].length, field[5].length, field[6].length);
+  }
+  DIE_UNLESS(field[0].length == 65535);
+  DIE_UNLESS(field[1].length == 255);
+  DIE_UNLESS(field[2].length == 16777215);
+  DIE_UNLESS(field[3].length == 4294967295UL);
+  DIE_UNLESS(field[4].length == 255);
+  DIE_UNLESS(field[5].length == 255);
+  DIE_UNLESS(field[6].length == 255);
+
+  /* III. Cleanup */
+  rc= mysql_query(mysql, "drop table t1");
+  myquery(rc);
+  rc= mysql_query(mysql, "set names default");
+  myquery(rc);
+  mysql_stmt_close(stmt);
+}
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -14884,6 +14965,8 @@
   { "test_bug13524", test_bug13524 },
   { "test_bug14845", test_bug14845 },
   { "test_bug15510", test_bug15510},
+  { "test_bug16144", test_bug16144 },
+  { "test_bug15613", test_bug15613 },
   { 0, 0 }
 };
 

--- 1.51/sql/sql_help.cc	2005-11-04 15:09:56 -05:00
+++ 1.52/sql/sql_help.cc	2006-01-30 08:27:39 -05:00
@@ -567,7 +567,7 @@
 
   SQL_SELECT *res= make_select(table, 0, 0, cond, 0, error);
   if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)) ||
-      (res->quick && res->quick->reset()))
+      (res && res->quick && res->quick->reset()))
   {
     delete res;
     res=0;
Thread
bk commit into 5.1 tree (elliot:1.2089)Elliot Murphy30 Jan