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

ChangeSet@stripped, 2007-01-22 14:10:46+02:00, monty@stripped +193 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-5.0-marvel
  into  mysql.com:/home/my/mysql-5.0
  MERGE: 1.2341.36.1

  client/mysql.cc@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.230.1.1

  client/mysql_upgrade.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.15.1.1

  client/mysqlbinlog.cc@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.130.2.2

  client/mysqldump.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.252.1.2

  client/mysqltest.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.268.1.2

  client/sql_string.cc@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.26.1.1

  client/sql_string.h@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.16.1.1

  extra/my_print_defaults.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.24.1.1

  include/m_ctype.h@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.124.1.1

  include/my_pthread.h@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.92.2.2

  include/my_sys.h@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.191.1.1

  include/my_time.h@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.17.1.1

  include/mysql.h@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.166.1.2

  libmysqld/lib_sql.cc@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.124.1.1

  myisam/ft_boolean_search.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.94.1.1

  myisam/mi_open.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.101.1.1

  myisam/mi_search.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.62.1.1

  myisam/mi_unique.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.27.1.1

  myisam/myisampack.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.57.1.1

  myisam/rt_index.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.18.1.1

  myisam/sort.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.58.1.1

  mysys/default.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.84.1.1

  mysys/mf_iocache2.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.28.1.1

  mysys/mf_keycache.c@stripped, 2007-01-22 14:10:36+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.58.1.1

  mysys/my_bitmap.c@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.35.1.1

  mysys/sha1.c@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.1

  ndb/include/kernel/signaldata/ArbitSignalData.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.4.1.1

  ndb/include/kernel/signaldata/DictTabInfo.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.1

  ndb/include/ndbapi/NdbReceiver.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.16.1.1

  ndb/include/transporter/TransporterDefinitions.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.13.1.1

  ndb/include/util/InputStream.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.6.1.1

  ndb/include/util/OutputStream.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.5.1.1

  ndb/include/util/SimpleProperties.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.1

  ndb/include/util/SocketAuthenticator.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.3.1.1

  ndb/include/util/SocketServer.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.10.1.1

  ndb/src/common/mgmcommon/ConfigRetriever.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.36.1.1

  ndb/src/common/portlib/NdbTick.c@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.6.1.1

  ndb/src/common/transporter/SHM_Transporter.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.17.1.1

  ndb/src/common/transporter/TCP_Transporter.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.11.1.1

  ndb/src/common/transporter/TCP_Transporter.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.6.1.1

  ndb/src/common/transporter/Transporter.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.23.1.1

  ndb/src/common/transporter/TransporterRegistry.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.62.1.1

  ndb/src/common/util/Bitmask.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.9.1.1

  ndb/src/common/util/ConfigValues.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.10.1.1

  ndb/src/common/util/File.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.14.1.1

  ndb/src/common/util/Properties.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.11.1.1

  ndb/src/common/util/SocketClient.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.9.1.1

  ndb/src/common/util/random.c@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.5.1.1

  ndb/src/common/util/socket_io.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.12.1.1

  ndb/src/cw/cpcd/APIService.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.9.1.1

  ndb/src/cw/cpcd/main.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.11.1.1

  ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.29.1.1

  ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.72.1.1

  ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.25.1.1

  ndb/src/kernel/blocks/dbdih/Dbdih.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.15.1.1

  ndb/src/kernel/blocks/dblqh/Dblqh.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.42.1.1

  ndb/src/kernel/blocks/dblqh/DblqhMain.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.98.1.1

  ndb/src/kernel/blocks/dbtc/Dbtc.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.37.1.1

  ndb/src/kernel/blocks/dbtup/Dbtup.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.29.1.1

  ndb/src/kernel/blocks/dbtup/DbtupScan.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.4.1.1

  ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.17.1.1

  ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.31.1.1

  ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.15.1.1

  ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.1

  ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.35.1.1

  ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.5.1.1

  ndb/src/kernel/blocks/qmgr/Qmgr.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.12.1.1

  ndb/src/kernel/blocks/qmgr/QmgrMain.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.37.1.1

  ndb/src/kernel/blocks/suma/Suma.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.23.1.1

  ndb/src/kernel/blocks/suma/Suma.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.1

  ndb/src/kernel/vm/MetaData.hpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.5.1.1

  ndb/src/mgmapi/LocalConfig.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.23.1.1

  ndb/src/mgmapi/mgmapi.cpp@stripped, 2007-01-22 14:10:37+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.67.1.1

  ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.72.1.1

  ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.81.1.1

  ndb/src/mgmsrv/ConfigInfo.hpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.12.1.1

  ndb/src/mgmsrv/InitConfigFileParser.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.27.1.1

  ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.110.1.1

  ndb/src/mgmsrv/MgmtSrvr.hpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.49.1.1

  ndb/src/mgmsrv/Services.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.73.1.1

  ndb/src/mgmsrv/main.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.49.1.1

  ndb/src/ndbapi/ClusterMgr.hpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.12.1.1

  ndb/src/ndbapi/Ndb.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.63.1.1

  ndb/src/ndbapi/NdbBlob.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.30.1.1

  ndb/src/ndbapi/NdbDictionaryImpl.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.96.1.1

  ndb/src/ndbapi/NdbIndexOperation.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.26.1.1

  ndb/src/ndbapi/NdbOperationDefine.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.1

  ndb/src/ndbapi/NdbOperationExec.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.22.1.1

  ndb/src/ndbapi/NdbOperationSearch.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.27.1.1

  ndb/src/ndbapi/NdbScanFilter.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.9.1.1

  ndb/src/ndbapi/NdbScanOperation.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.81.1.1

  ndb/src/ndbapi/SignalSender.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.1

  ndb/src/ndbapi/ndb_cluster_connection.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.38.1.1

  ndb/tools/delete_all.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.20.1.1

  ndb/tools/desc.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.22.1.1

  ndb/tools/drop_index.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.17.1.1

  ndb/tools/drop_tab.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.17.1.1

  ndb/tools/listTables.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.23.1.1

  ndb/tools/ndb_config.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.1

  ndb/tools/restore/Restore.hpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.1

  ndb/tools/restore/consumer.hpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.1

  ndb/tools/restore/restore_main.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.37.1.1

  ndb/tools/select_all.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.24.1.1

  ndb/tools/select_count.cpp@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.1

  server-tools/instance-manager/commands.h@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.10.1.1

  server-tools/instance-manager/guardian.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.25.1.2

  server-tools/instance-manager/instance_options.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.33.1.1

  server-tools/instance-manager/mysql_connection.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.16.1.1

  server-tools/instance-manager/options.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.34.1.1

  server-tools/instance-manager/options.h@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.17.1.1

  server-tools/instance-manager/parse.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.14.1.1

  server-tools/instance-manager/user_map.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.16.1.1

  server-tools/instance-manager/user_map.h@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.6.1.1

  sql-common/client.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.104.1.4

  sql-common/my_time.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.25.1.7

  sql/field.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.336.1.1

  sql/field.h@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.193.1.1

  sql/filesort.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.109.1.3

  sql/ha_archive.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.79.1.1

  sql/ha_archive.h@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.36.1.1

  sql/ha_federated.cc@stripped, 2007-01-22 14:10:38+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.73.1.1

  sql/ha_heap.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.81.1.1

  sql/ha_myisam.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.171.1.1

  sql/ha_myisammrg.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.86.1.1

  sql/ha_ndbcluster.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.293.1.1

  sql/handler.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.222.1.5

  sql/item.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.246.1.1

  sql/item.h@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.214.1.1

  sql/item_cmpfunc.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.224.3.2

  sql/item_cmpfunc.h@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.134.1.2

  sql/item_func.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.318.1.1

  sql/item_geofunc.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.28.1.1

  sql/item_row.h@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.22.1.1

  sql/item_strfunc.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.292.1.1

  sql/item_subselect.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.142.2.2

  sql/item_subselect.h@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.83.1.2

  sql/item_sum.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.193.1.1

  sql/item_timefunc.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.133.4.2

  sql/log.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.198.1.2

  sql/log_event.cc@stripped, 2007-01-22 14:10:39+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.214.1.4

  sql/log_event.h@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.126.2.2

  sql/mysql_priv.h@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.425.1.2

  sql/mysqld.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.583.1.1

  sql/net_serv.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.93.1.2

  sql/opt_range.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.234.1.2

  sql/opt_range.h@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.66.1.1

  sql/password.c@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.41.1.1

  sql/protocol.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.119.1.1

  sql/repl_failsafe.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.62.1.1

  sql/set_var.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.173.1.2

  sql/set_var.h@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.78.1.2

  sql/slave.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.288.1.1

  sql/sp.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.125.1.1

  sql/sp_head.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.225.1.3

  sql/sp_head.h@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.88.1.2

  sql/spatial.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.28.1.1

  sql/spatial.h@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.1

  sql/sql_cache.h@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.34.1.1

  sql/sql_class.cc@stripped, 2007-01-22 14:10:40+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.254.1.4

  sql/sql_class.h@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.310.8.2

  sql/sql_derived.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.79.1.1

  sql/sql_insert.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.211.1.3

  sql/sql_lex.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.206.3.2

  sql/sql_lex.h@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.234.1.1

  sql/sql_load.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.103.1.1

  sql/sql_parse.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.590.6.3

  sql/sql_prepare.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.188.1.1

  sql/sql_select.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.475.1.5

  sql/sql_show.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.333.1.2

  sql/sql_string.cc@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.95.1.1

  sql/sql_string.h@stripped, 2007-01-22 14:10:41+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.64.1.1

  sql/sql_table.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.330.1.1

  sql/sql_trigger.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.61.1.1

  sql/sql_trigger.h@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.23.1.1

  sql/sql_union.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.135.1.1

  sql/sql_update.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.206.1.1

  sql/sql_view.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.102.1.1

  sql/sql_yacc.yy@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.499.1.1

  sql/table.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.237.1.5

  sql/tztime.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.37.1.1

  sql/unireg.cc@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.79.1.1

  strings/ctype-bin.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.72.1.1

  strings/ctype-cp932.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.14.1.1

  strings/ctype-eucjpms.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.15.1.1

  strings/ctype-mb.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.53.1.1

  strings/ctype-simple.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.80.1.1

  strings/ctype-sjis.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.91.1.1

  strings/ctype-uca.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.41.1.1

  strings/ctype-ujis.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.72.1.1

  strings/ctype-utf8.c@stripped, 2007-01-22 14:10:42+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.102.1.1

  strings/decimal.c@stripped, 2007-01-22 14:10:43+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.71.1.3

  strings/my_vsnprintf.c@stripped, 2007-01-22 14:10:43+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.36.1.1

  tests/mysql_client_test.c@stripped, 2007-01-22 14:10:43+02:00, monty@stripped +0 -0
    Auto merged
    MERGE: 1.217.1.2

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	monty
# Host:	narttu.mysql.fi
# Root:	/home/my/mysql-5.0/RESYNC

--- 1.192/include/my_sys.h	2007-01-09 18:06:42 +02:00
+++ 1.193/include/my_sys.h	2007-01-22 14:10:36 +02:00
@@ -781,6 +781,8 @@
 extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
 my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
 			  uint length);
+extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
+                                       ...);
 extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
 extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
 extern void dynstr_free(DYNAMIC_STRING *str);

--- 1.85/mysys/default.c	2007-01-09 18:06:42 +02:00
+++ 1.86/mysys/default.c	2007-01-22 14:10:36 +02:00
@@ -978,10 +978,11 @@
 
   Everywhere else, this is:
     1. /etc/
-    2. getenv(DEFAULT_HOME_ENV)
-    3. ""
-    4. "~/"
-    5. --sysconfdir=<path>
+    2. /etc/mysql/
+    3. getenv(DEFAULT_HOME_ENV)
+    4. ""
+    5. "~/"
+    6. --sysconfdir=<path>
 
  */
 
@@ -1007,6 +1008,7 @@
     *ptr++= env;
 #endif
   *ptr++= "/etc/";
+  *ptr++= "/etc/mysql/";
 #endif
   if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV))))
     *ptr++= env;

--- 1.337/sql/field.cc	2007-01-09 18:06:48 +02:00
+++ 1.338/sql/field.cc	2007-01-22 14:10:38 +02:00
@@ -7826,6 +7826,16 @@
 }
 
 
+Field *Field_enum::new_field(MEM_ROOT *root, struct st_table *new_table,
+                             bool keep_type)
+{
+  Field_enum *res= (Field_enum*) Field::new_field(root, new_table, keep_type);
+  if (res)
+    res->typelib= copy_typelib(root, typelib);
+  return res;
+}
+
+
 /*
    set type.
    This is a string which can have a collection of different values.
@@ -8019,6 +8029,7 @@
     bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7),
     bytes_in_rec(len_arg / 8)
 {
+  flags|= UNSIGNED_FLAG;
   /*
     Ensure that Field::eq() can distinguish between two different bit fields.
     (two bit fields that are not null, may have same ptr and null_ptr)
@@ -8258,6 +8269,7 @@
   : Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0,
               0, unireg_check_arg, field_name_arg, table_arg)
 {
+  flags|= UNSIGNED_FLAG;
   bit_len= 0;
   bytes_in_rec= (len_arg + 7) / 8;
 }

--- 1.194/sql/field.h	2007-01-09 18:06:48 +02:00
+++ 1.195/sql/field.h	2007-01-22 14:10:38 +02:00
@@ -1034,7 +1034,8 @@
   bool zero_pack() const { return 0; }
   int reset(void)
   {
-    charset()->cset->fill(charset(),ptr,field_length,' ');
+    charset()->cset->fill(charset(),ptr,field_length,
+                          (has_charset() ? ' ' : 0));
     return 0;
   }
   int store(const char *to,uint length,CHARSET_INFO *charset);
@@ -1297,6 +1298,7 @@
   {
       flags|=ENUM_FLAG;
   }
+  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
   enum_field_types type() const { return FIELD_TYPE_STRING; }
   enum Item_result cmp_type () const { return INT_RESULT; }
   enum Item_result cast_to_int_type () const { return INT_RESULT; }

--- 1.247/sql/item.cc	2007-01-09 18:06:49 +02:00
+++ 1.248/sql/item.cc	2007-01-22 14:10:39 +02:00
@@ -3696,6 +3696,8 @@
         Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
                                       &counter, REPORT_EXCEPT_NOT_FOUND,
                                       &not_used);
+        if (!res)
+          return 1;
         if (res != (Item **)not_found_item)
         {
           if ((*res)->type() == Item::FIELD_ITEM)
@@ -4549,18 +4551,31 @@
 
 int Item_hex_string::save_in_field(Field *field, bool no_conversions)
 {
-  int error;
   field->set_notnull();
   if (field->result_type() == STRING_RESULT)
+    return field->store(str_value.ptr(), str_value.length(), 
+                        collation.collation);
+
+  ulonglong nr;
+  uint32 length= str_value.length();
+  if (length > 8)
   {
-    error=field->store(str_value.ptr(),str_value.length(),collation.collation);
+    nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX;
+    goto warn;
   }
-  else
+  nr= (ulonglong) val_int();
+  if ((length == 8) && !(field->flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX))
   {
-    longlong nr=val_int();
-    error=field->store(nr, TRUE);    // Assume hex numbers are unsigned
+    nr= LONGLONG_MAX;
+    goto warn;
   }
-  return error;
+  return field->store((longlong) nr, TRUE);  // Assume hex numbers are unsigned
+
+warn:
+  if (!field->store((longlong) nr, TRUE))
+    field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE,
+                       1);
+  return 1;
 }
 
 

--- 1.320/sql/item_func.cc	2007-01-11 17:42:44 +02:00
+++ 1.321/sql/item_func.cc	2007-01-22 14:10:39 +02:00
@@ -3688,8 +3688,9 @@
 	char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry));
 	if (entry->value == pos)
 	  entry->value=0;
-	if (!(entry->value=(char*) my_realloc(entry->value, length,
-					      MYF(MY_ALLOW_ZERO_PTR))))
+        entry->value= (char*) my_realloc(entry->value, length,
+                                         MYF(MY_ALLOW_ZERO_PTR | MY_WME));
+        if (!entry->value)
 	  return 1;
       }
     }
@@ -4056,6 +4057,105 @@
   else
     Item::make_field(tmp_field);
 }
+
+
+/*
+  Save the value of a user variable into a field
+
+  SYNOPSIS
+    save_in_field()
+      field           target field to save the value to
+      no_conversion   flag indicating whether conversions are allowed
+
+  DESCRIPTION
+    Save the function value into a field and update the user variable
+    accordingly. If a result field is defined and the target field doesn't
+    coincide with it then the value from the result field will be used as
+    the new value of the user variable.
+
+    The reason to have this method rather than simply using the result
+    field in the val_xxx() methods is that the value from the result field
+    not always can be used when the result field is defined.
+    Let's consider the following cases:
+    1) when filling a tmp table the result field is defined but the value of it
+    is undefined because it has to be produced yet. Thus we can't use it.
+    2) on execution of an INSERT ... SELECT statement the save_in_field()
+    function will be called to fill the data in the new record. If the SELECT
+    part uses a tmp table then the result field is defined and should be
+    used in order to get the correct result.
+
+    The difference between the SET_USER_VAR function and regular functions
+    like CONCAT is that the Item_func objects for the regular functions are
+    replaced by Item_field objects after the values of these functions have
+    been stored in a tmp table. Yet an object of the Item_field class cannot
+    be used to update a user variable.
+    Due to this we have to handle the result field in a special way here and
+    in the Item_func_set_user_var::send() function.
+
+  RETURN VALUES
+    FALSE       Ok
+    TRUE        Error
+*/
+
+int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions)
+{
+  bool use_result_field= (result_field && result_field != field);
+  int error;
+
+  /* Update the value of the user variable */
+  check(use_result_field);
+  update();
+
+  if (result_type() == STRING_RESULT ||
+      result_type() == REAL_RESULT &&
+      field->result_type() == STRING_RESULT)
+  {
+    String *result;
+    CHARSET_INFO *cs= collation.collation;
+    char buff[MAX_FIELD_WIDTH];		// Alloc buffer for small columns
+    str_value.set_quick(buff, sizeof(buff), cs);
+    result= entry->val_str(&null_value, &str_value, decimals);
+
+    if (null_value)
+    {
+      str_value.set_quick(0, 0, cs);
+      return set_field_to_null_with_conversions(field, no_conversions);
+    }
+
+    /* NOTE: If null_value == FALSE, "result" must be not NULL.  */
+
+    field->set_notnull();
+    error=field->store(result->ptr(),result->length(),cs);
+    str_value.set_quick(0, 0, cs);
+  }
+  else if (result_type() == REAL_RESULT)
+  {
+    double nr= entry->val_real(&null_value);
+    if (null_value)
+      return set_field_to_null(field);
+    field->set_notnull();
+    error=field->store(nr);
+  }
+  else if (result_type() == DECIMAL_RESULT)
+  {
+    my_decimal decimal_value;
+    my_decimal *value= entry->val_decimal(&null_value, &decimal_value);
+    if (null_value)
+      return set_field_to_null(field);
+    field->set_notnull();
+    error=field->store_decimal(value);
+  }
+  else
+  {
+    longlong nr= entry->val_int(&null_value);
+    if (null_value)
+      return set_field_to_null_with_conversions(field, no_conversions);
+    field->set_notnull();
+    error=field->store(nr, unsigned_flag);
+  }
+  return error;
+}
+
 
 String *
 Item_func_get_user_var::val_str(String *str)

--- 1.194/sql/item_sum.cc	2007-01-09 18:06:50 +02:00
+++ 1.195/sql/item_sum.cc	2007-01-22 14:10:39 +02:00
@@ -1113,7 +1113,7 @@
   {
     /*
       We must store both value and counter in the temporary table in one field.
-      The easyest way is to do this is to store both value in a string
+      The easiest way is to do this is to store both value in a string
       and unpack on access.
     */
     return new Field_string(((hybrid_type == DECIMAL_RESULT) ?
@@ -1187,8 +1187,9 @@
 double Item_sum_std::val_real()
 {
   DBUG_ASSERT(fixed == 1);
-  double tmp= Item_sum_variance::val_real();
-  return tmp <= 0.0 ? 0.0 : sqrt(tmp);
+  double nr= Item_sum_variance::val_real();
+  DBUG_ASSERT(nr >= 0.0);
+  return sqrt(nr);
 }
 
 Item *Item_sum_std::copy_or_same(THD* thd)
@@ -1202,40 +1203,77 @@
 */
 
 
-Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item):
-  Item_sum_num(thd, item), hybrid_type(item->hybrid_type),
-    cur_dec(item->cur_dec), count(item->count), sample(item->sample),
-    prec_increment(item->prec_increment)
+/**
+  Variance implementation for floating-point implementations, without
+  catastrophic cancellation, from Knuth's _TAoCP_, 3rd ed, volume 2, pg232.
+  This alters the value at m, s, and increments count.
+*/
+
+/*
+  These two functions are used by the Item_sum_variance and the
+  Item_variance_field classes, which are unrelated, and each need to calculate
+  variance.  The difference between the two classes is that the first is used
+  for a mundane SELECT, while the latter is used in a GROUPing SELECT.
+*/
+static void variance_fp_recurrence_next(double *m, double *s, ulonglong *count, double nr)
 {
-  if (hybrid_type == DECIMAL_RESULT)
+  *count += 1;
+
+  if (*count == 1) 
   {
-    memcpy(dec_sum, item->dec_sum, sizeof(item->dec_sum));
-    memcpy(dec_sqr, item->dec_sqr, sizeof(item->dec_sqr));
-    for (int i=0; i<2; i++)
-    {
-      dec_sum[i].fix_buffer_pointer();
-      dec_sqr[i].fix_buffer_pointer();
-    }
+    *m= nr;
+    *s= 0;
   }
   else
   {
-    sum= item->sum;
-    sum_sqr= item->sum_sqr;
+    double m_kminusone= *m;
+    *m= m_kminusone + (nr - m_kminusone) / (double) *count;
+    *s= *s + (nr - m_kminusone) * (nr - *m);
   }
 }
 
 
+static double variance_fp_recurrence_result(double s, ulonglong count, bool is_sample_variance)
+{
+  if (count == 1)
+    return 0.0;
+
+  if (is_sample_variance)
+    return s / (count - 1);
+
+  /* else, is a population variance */
+  return s / count;
+}
+
+
+Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item):
+  Item_sum_num(thd, item), hybrid_type(item->hybrid_type),
+    count(item->count), sample(item->sample),
+    prec_increment(item->prec_increment)
+{
+  recurrence_m= item->recurrence_m;
+  recurrence_s= item->recurrence_s;
+}
+
+
 void Item_sum_variance::fix_length_and_dec()
 {
   DBUG_ENTER("Item_sum_variance::fix_length_and_dec");
   maybe_null= null_value= 1;
   prec_increment= current_thd->variables.div_precincrement;
+
+  /*
+    According to the SQL2003 standard (Part 2, Foundations; sec 10.9,
+    aggregate function; paragraph 7h of Syntax Rules), "the declared 
+    type of the result is an implementation-defined aproximate numeric
+    type.
+  */
+  hybrid_type= REAL_RESULT;
+
   switch (args[0]->result_type()) {
   case REAL_RESULT:
   case STRING_RESULT:
     decimals= min(args[0]->decimals + 4, NOT_FIXED_DEC);
-    hybrid_type= REAL_RESULT;
-    sum= 0.0;
     break;
   case INT_RESULT:
   case DECIMAL_RESULT:
@@ -1244,37 +1282,14 @@
     decimals= min(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE);
     max_length= my_decimal_precision_to_length(precision, decimals,
                                                unsigned_flag);
-    cur_dec= 0;
-    hybrid_type= DECIMAL_RESULT;
-    my_decimal_set_zero(dec_sum);
-    my_decimal_set_zero(dec_sqr);
 
-    /*
-      The maxium value to usable for variance is DECIMAL_MAX_LENGTH/2
-      becasue we need to be able to calculate in dec_bin_size1
-      column_value * column_value
-    */
-    f_scale0= args[0]->decimals;
-    f_precision0= min(args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS,
-                      DECIMAL_MAX_PRECISION);
-    f_scale1= min(args[0]->decimals * 2, DECIMAL_MAX_SCALE);
-    f_precision1= min(args[0]->decimal_precision()*2 + DECIMAL_LONGLONG_DIGITS,
-                      DECIMAL_MAX_PRECISION);
-    dec_bin_size0= my_decimal_get_binary_size(f_precision0, f_scale0);
-    dec_bin_size1= my_decimal_get_binary_size(f_precision1, f_scale1);
     break;
   }
   case ROW_RESULT:
   default:
     DBUG_ASSERT(0);
   }
-  DBUG_PRINT("info", ("Type: %s (%d, %d)",
-                      (hybrid_type == REAL_RESULT ? "REAL_RESULT" :
-                       hybrid_type == DECIMAL_RESULT ? "DECIMAL_RESULT" :
-                       hybrid_type == INT_RESULT ? "INT_RESULT" :
-                       "--ILLEGAL!!!--"),
-                      max_length,
-                      (int)decimals));
+  DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals));
   DBUG_VOID_RETURN;
 }
 
@@ -1285,6 +1300,11 @@
 }
 
 
+/**
+  Create a new field to match the type of value we're expected to yield.
+  If we're grouping, then we need some space to serialize variables into, to
+  pass around.
+*/
 Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table,
                                            uint convert_blob_len)
 {
@@ -1292,13 +1312,10 @@
   {
     /*
       We must store both value and counter in the temporary table in one field.
-      The easyest way is to do this is to store both value in a string
+      The easiest way is to do this is to store both value in a string
       and unpack on access.
     */
-    return new Field_string(((hybrid_type == DECIMAL_RESULT) ?
-                             dec_bin_size0 + dec_bin_size1 :
-                             sizeof(double)*2) + sizeof(longlong),
-                            0, name, table, &my_charset_bin);
+    return new Field_string(sizeof(double)*2 + sizeof(longlong), 0, name, table, &my_charset_bin);
   }
   return new Field_double(max_length, maybe_null,name,table,decimals);
 }
@@ -1306,90 +1323,51 @@
 
 void Item_sum_variance::clear()
 {
-  if (hybrid_type == DECIMAL_RESULT)
-  {
-    my_decimal_set_zero(dec_sum);
-    my_decimal_set_zero(dec_sqr);
-    cur_dec= 0;
-  }
-  else
-    sum=sum_sqr=0.0; 
-  count=0; 
+  count= 0; 
 }
 
 bool Item_sum_variance::add()
 {
-  if (hybrid_type == DECIMAL_RESULT)
-  {
-    my_decimal dec_buf, *dec= args[0]->val_decimal(&dec_buf);
-    my_decimal sqr_buf;
-    if (!args[0]->null_value)
-    {
-      count++;
-      int next_dec= cur_dec ^ 1;
-      my_decimal_mul(E_DEC_FATAL_ERROR, &sqr_buf, dec, dec);
-      my_decimal_add(E_DEC_FATAL_ERROR, dec_sqr+next_dec,
-                     dec_sqr+cur_dec, &sqr_buf);
-      my_decimal_add(E_DEC_FATAL_ERROR, dec_sum+next_dec,
-                     dec_sum+cur_dec, dec);
-      cur_dec= next_dec;
-    }
-  }
-  else
-  {
-    double nr= args[0]->val_real();
-    if (!args[0]->null_value)
-    {
-      sum+=nr;
-      sum_sqr+=nr*nr;
-      count++;
-    }
-  }
+  /* 
+    Why use a temporary variable?  We don't know if it is null until we
+    evaluate it, which has the side-effect of setting null_value .
+  */
+  double nr= args[0]->val_real();
+  
+  if (!args[0]->null_value)
+    variance_fp_recurrence_next(&recurrence_m, &recurrence_s, &count, nr);
   return 0;
 }
 
 double Item_sum_variance::val_real()
 {
   DBUG_ASSERT(fixed == 1);
-  if (hybrid_type == DECIMAL_RESULT)
-    return val_real_from_decimal();
 
+  /*
+    'sample' is a 1/0 boolean value.  If it is 1/true, id est this is a sample
+    variance call, then we should set nullness when the count of the items
+    is one or zero.  If it's zero, i.e. a population variance, then we only
+    set nullness when the count is zero.
+
+    Another way to read it is that 'sample' is the numerical threshhold, at and
+    below which a 'count' number of items is called NULL.
+  */
+  DBUG_ASSERT((sample == 0) || (sample == 1));
   if (count <= sample)
   {
     null_value=1;
     return 0.0;
   }
+
   null_value=0;
-  /* Avoid problems when the precision isn't good enough */
-  double tmp=ulonglong2double(count);
-  double tmp2= (sum_sqr - sum*sum/tmp)/(tmp - (double)sample);
-  return tmp2 <= 0.0 ? 0.0 : tmp2;
+  return variance_fp_recurrence_result(recurrence_s, count, sample);
 }
 
 
 my_decimal *Item_sum_variance::val_decimal(my_decimal *dec_buf)
 {
-  my_decimal count_buf, count1_buf, sum_sqr_buf;
-  DBUG_ASSERT(fixed ==1 );
-  if (hybrid_type == REAL_RESULT)
-    return val_decimal_from_real(dec_buf);
-
-  if (count <= sample)
-  {
-    null_value= 1;
-    return 0;
-  }
-  null_value= 0;
-  int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &count_buf);
-  int2my_decimal(E_DEC_FATAL_ERROR, count-sample, 0, &count1_buf);
-  my_decimal_mul(E_DEC_FATAL_ERROR, &sum_sqr_buf,
-                 dec_sum+cur_dec, dec_sum+cur_dec);
-  my_decimal_div(E_DEC_FATAL_ERROR, dec_buf,
-                 &sum_sqr_buf, &count_buf, prec_increment);
-  my_decimal_sub(E_DEC_FATAL_ERROR, &sum_sqr_buf, dec_sqr+cur_dec, dec_buf);
-  my_decimal_div(E_DEC_FATAL_ERROR, dec_buf,
-                 &sum_sqr_buf, &count1_buf, prec_increment);
-  return dec_buf;
+  DBUG_ASSERT(fixed == 1);
+  return val_decimal_from_real(dec_buf);
 }
 
 
@@ -1398,89 +1376,44 @@
   double nr;
   char *res= result_field->ptr;
 
-  if (hybrid_type == DECIMAL_RESULT)
-  {
-    my_decimal value, *arg_dec, *arg2_dec;
-    longlong tmp;
-
-    arg_dec= args[0]->val_decimal(&value);
-    if (args[0]->null_value)
-    {
-      arg_dec= arg2_dec= &decimal_zero;
-      tmp= 0;
-    }
-    else
-    {
-      my_decimal_mul(E_DEC_FATAL_ERROR, dec_sum, arg_dec, arg_dec);
-      arg2_dec= dec_sum;
-      tmp= 1;
-    }
-    my_decimal2binary(E_DEC_FATAL_ERROR, arg_dec,
-                      res, f_precision0, f_scale0);
-    my_decimal2binary(E_DEC_FATAL_ERROR, arg2_dec,
-                      res+dec_bin_size0, f_precision1, f_scale1);
-    res+= dec_bin_size0 + dec_bin_size1;
-    int8store(res,tmp);
-    return;
-  }
-  nr= args[0]->val_real();
+  nr= args[0]->val_real();              /* sets null_value as side-effect */
 
   if (args[0]->null_value)
     bzero(res,sizeof(double)*2+sizeof(longlong));
   else
   {
-    longlong tmp;
-    float8store(res,nr);
-    nr*=nr;
-    float8store(res+sizeof(double),nr);
-    tmp= 1;
-    int8store(res+sizeof(double)*2,tmp);
+    /* Serialize format is (double)m, (double)s, (longlong)count */
+    ulonglong tmp_count;
+    double tmp_s;
+    float8store(res, nr);               /* recurrence variable m */
+    tmp_s= 0.0;
+    float8store(res + sizeof(double), tmp_s);
+    tmp_count= 1;
+    int8store(res + sizeof(double)*2, tmp_count);
   }
 }
 
 
 void Item_sum_variance::update_field()
 {
-  longlong field_count;
+  ulonglong field_count;
   char *res=result_field->ptr;
-  if (hybrid_type == DECIMAL_RESULT)
-  {
-    my_decimal value, *arg_val= args[0]->val_decimal(&value);
-    if (!args[0]->null_value)
-    {
-      binary2my_decimal(E_DEC_FATAL_ERROR, res,
-                        dec_sum+1, f_precision0, f_scale0);
-      binary2my_decimal(E_DEC_FATAL_ERROR, res+dec_bin_size0,
-                        dec_sqr+1, f_precision1, f_scale1);
-      field_count= sint8korr(res + (dec_bin_size0 + dec_bin_size1));
-      my_decimal_add(E_DEC_FATAL_ERROR, dec_sum, arg_val, dec_sum+1);
-      my_decimal_mul(E_DEC_FATAL_ERROR, dec_sum+1, arg_val, arg_val);
-      my_decimal_add(E_DEC_FATAL_ERROR, dec_sqr, dec_sqr+1, dec_sum+1);
-      field_count++;
-      my_decimal2binary(E_DEC_FATAL_ERROR, dec_sum,
-                        res, f_precision0, f_scale0);
-      my_decimal2binary(E_DEC_FATAL_ERROR, dec_sqr,
-                        res+dec_bin_size0, f_precision1, f_scale1);
-      res+= dec_bin_size0 + dec_bin_size1;
-      int8store(res, field_count);
-    }
+
+  double nr= args[0]->val_real();       /* sets null_value as side-effect */
+
+  if (args[0]->null_value)
     return;
-  }
 
-  double nr,old_nr,old_sqr;
-  float8get(old_nr, res);
-  float8get(old_sqr, res+sizeof(double));
+  /* Serialize format is (double)m, (double)s, (longlong)count */
+  double field_recurrence_m, field_recurrence_s;
+  float8get(field_recurrence_m, res);
+  float8get(field_recurrence_s, res + sizeof(double));
   field_count=sint8korr(res+sizeof(double)*2);
 
-  nr= args[0]->val_real();
-  if (!args[0]->null_value)
-  {
-    old_nr+=nr;
-    old_sqr+=nr*nr;
-    field_count++;
-  }
-  float8store(res,old_nr);
-  float8store(res+sizeof(double),old_sqr);
+  variance_fp_recurrence_next(&field_recurrence_m, &field_recurrence_s, &field_count, nr);
+
+  float8store(res, field_recurrence_m);
+  float8store(res + sizeof(double), field_recurrence_s);
   res+= sizeof(double)*2;
   int8store(res,field_count);
 }
@@ -2310,25 +2243,9 @@
 {
   double nr;
   // fix_fields() never calls for this Item
-  if (hybrid_type == REAL_RESULT)
-  {
-    /*
-      We can't call Item_variance_field::val_real() on a DECIMAL_RESULT
-      as this would call Item_std_field::val_decimal() and we would
-      calculate sqrt() twice
-    */
-    nr= Item_variance_field::val_real();
-  }
-  else
-  {
-    my_decimal dec_buf,*dec;
-    dec= Item_variance_field::val_decimal(&dec_buf);
-    if (!dec)
-      nr= 0.0;                                  // NULL; Return 0.0
-    else
-      my_decimal2double(E_DEC_FATAL_ERROR, dec, &nr);
-  }
-  return nr <= 0.0 ? 0.0 : sqrt(nr);
+  nr= Item_variance_field::val_real();
+  DBUG_ASSERT(nr >= 0.0);
+  return sqrt(nr);
 }
 
 
@@ -2342,11 +2259,13 @@
   double nr;
   if (hybrid_type == REAL_RESULT)
     return val_decimal_from_real(dec_buf);
+
   dec= Item_variance_field::val_decimal(dec_buf);
   if (!dec)
     return 0;
   my_decimal2double(E_DEC_FATAL_ERROR, dec, &nr);
-  nr= nr <= 0.0 ? 0.0 : sqrt(nr);
+  DBUG_ASSERT(nr >= 0.0);
+  nr= sqrt(nr);
   double2my_decimal(E_DEC_FATAL_ERROR, nr, &tmp_dec);
   my_decimal_round(E_DEC_FATAL_ERROR, &tmp_dec, decimals, FALSE, dec_buf);
   return dec_buf;
@@ -2381,52 +2300,15 @@
   if (hybrid_type == DECIMAL_RESULT)
     return val_real_from_decimal();
 
-  double sum,sum_sqr;
-  longlong count;
-  float8get(sum,field->ptr);
-  float8get(sum_sqr,(field->ptr+sizeof(double)));
+  double recurrence_s;
+  ulonglong count;
+  float8get(recurrence_s, (field->ptr + sizeof(double)));
   count=sint8korr(field->ptr+sizeof(double)*2);
 
   if ((null_value= (count <= sample)))
     return 0.0;
 
-  double tmp= (double) count;
-  double tmp2= (sum_sqr - sum*sum/tmp)/(tmp - (double)sample);
-  return tmp2 <= 0.0 ? 0.0 : tmp2;
-}
-
-
-String *Item_variance_field::val_str(String *str)
-{
-  if (hybrid_type == DECIMAL_RESULT)
-    return val_string_from_decimal(str);
-  return val_string_from_real(str);
-}
-
-
-my_decimal *Item_variance_field::val_decimal(my_decimal *dec_buf)
-{
-  // fix_fields() never calls for this Item
-  if (hybrid_type == REAL_RESULT)
-    return val_decimal_from_real(dec_buf);
-
-  longlong count= sint8korr(field->ptr+dec_bin_size0+dec_bin_size1);
-  if ((null_value= (count <= sample)))
-    return 0;
-
-  my_decimal dec_count, dec1_count, dec_sum, dec_sqr, tmp;
-  int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &dec_count);
-  int2my_decimal(E_DEC_FATAL_ERROR, count-sample, 0, &dec1_count);
-  binary2my_decimal(E_DEC_FATAL_ERROR, field->ptr,
-                    &dec_sum, f_precision0, f_scale0);
-  binary2my_decimal(E_DEC_FATAL_ERROR, field->ptr+dec_bin_size0,
-                    &dec_sqr, f_precision1, f_scale1);
-  my_decimal_mul(E_DEC_FATAL_ERROR, &tmp, &dec_sum, &dec_sum);
-  my_decimal_div(E_DEC_FATAL_ERROR, dec_buf, &tmp, &dec_count, prec_increment);
-  my_decimal_sub(E_DEC_FATAL_ERROR, &dec_sum, &dec_sqr, dec_buf);
-  my_decimal_div(E_DEC_FATAL_ERROR, dec_buf,
-                 &dec_sum, &dec1_count, prec_increment);
-  return dec_buf;
+  return variance_fp_recurrence_result(recurrence_s, count, sample);
 }
 
 

--- 1.585/sql/mysqld.cc	2007-01-11 17:42:44 +02:00
+++ 1.586/sql/mysqld.cc	2007-01-22 14:10:40 +02:00
@@ -3371,8 +3371,10 @@
 int main(int argc, char **argv)
 #endif
 {
-  DEBUGGER_OFF;
   MY_INIT(argv[0]);		// init my_sys library & pthreads
+  /* ^^^  Nothing should be before this line! */
+
+  DEBUGGER_OFF;
 
 #ifdef _CUSTOMSTARTUPCONFIG_
   if (_cust_check_startup())
@@ -3522,7 +3524,7 @@
   */
   error_handler_hook= my_message_sql;
   start_signal_handler();				// Creates pidfile
-  if (acl_init(opt_noacl) ||
+  if (mysql_rm_tmp_tables() || acl_init(opt_noacl) ||
       my_tz_init((THD *)0, default_tz_name, opt_bootstrap))
   {
     abort_loop=1;
@@ -5494,6 +5496,11 @@
    0, 0, 0, 0, 0},
   {"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
    (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
+   /*
+     The system call realpath() produces warnings under valgrind and
+     purify. These are not suppressed: instead we disable symlinks
+     option if compiled with valgrind support. 
+   */
    IF_PURIFY(0,1), 0, 0, 0, 0, 0},
   {"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},

--- 1.212/sql/sql_insert.cc	2007-01-09 18:06:52 +02:00
+++ 1.213/sql/sql_insert.cc	2007-01-22 14:10:41 +02:00
@@ -2614,11 +2614,11 @@
                           temporary table flag)
       create_table in     Pointer to TABLE_LIST object providing database
                           and name for table to be created or to be open
-      extra_fields in/out Initial list of fields for table to be created
-      keys         in     List of keys for table to be created
+      alter_info   in/out Initial list of columns and indexes for the table
+                          to be created
       items        in     List of items which should be used to produce rest
                           of fields for the table (corresponding fields will
-                          be added to the end of 'extra_fields' list)
+                          be added to the end of alter_info->create_list)
       lock         out    Pointer to the MYSQL_LOCK object for table created
                           (open) will be returned in this parameter. Since
                           this table is not included in THD::lock caller is
@@ -2640,8 +2640,8 @@
 
 static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
                                       TABLE_LIST *create_table,
-                                      List<create_field> *extra_fields,
-                                      List<Key> *keys, List<Item> *items,
+                                      Alter_info *alter_info,
+                                      List<Item> *items,
                                       MYSQL_LOCK **lock)
 {
   TABLE tmp_table;		// Used during 'create_field()'
@@ -2680,7 +2680,7 @@
       DBUG_RETURN(0);
     if (item->maybe_null)
       cr_field->flags &= ~NOT_NULL_FLAG;
-    extra_fields->push_back(cr_field);
+    alter_info->create_list.push_back(cr_field);
   }
   /*
     create and lock table
@@ -2701,8 +2701,7 @@
   {
     tmp_disable_binlog(thd);
     if (!mysql_create_table(thd, create_table->db, create_table->table_name,
-                            create_info, *extra_fields, *keys, 0,
-                            select_field_count))
+                            create_info, alter_info, 0, select_field_count))
     {
       /*
         If we are here in prelocked mode we either create temporary table
@@ -2758,7 +2757,7 @@
 
   unit= u;
   table= create_table_from_items(thd, create_info, create_table,
-				 extra_fields, keys, &values, &lock);
+                                 alter_info, &values, &lock);
   if (!table)
     DBUG_RETURN(-1);				// abort() deletes table
 

--- 1.235/sql/sql_lex.h	2007-01-09 18:06:53 +02:00
+++ 1.236/sql/sql_lex.h	2007-01-22 14:10:41 +02:00
@@ -518,7 +518,6 @@
 
   SQL_LIST order_list;                /* ORDER clause */
   List<List_item>     expr_list;
-  List<List_item>     when_list;      /* WHEN clause (expression) */
   SQL_LIST *gorder_list;
   Item *select_limit, *offset_limit;  /* LIMIT clause parameters */
   // Arrays of pointers to top elements of all_fields list
@@ -688,18 +687,58 @@
 #define ALTER_CONVERT          1024
 #define ALTER_FORCE		2048
 
-typedef struct st_alter_info
+/**
+  @brief Parsing data for CREATE or ALTER TABLE.
+
+  This structure contains a list of columns or indexes to be created,
+  altered or dropped.
+*/
+
+class Alter_info
 {
+public:
   List<Alter_drop>            drop_list;
   List<Alter_column>          alter_list;
+  List<Key>	              key_list;
+  List<create_field>          create_list;
   uint                        flags;
   enum enum_enable_or_disable keys_onoff;
   enum tablespace_op_type     tablespace_op;
 
-  st_alter_info(){clear();}
-  void clear(){keys_onoff= LEAVE_AS_IS;tablespace_op= NO_TABLESPACE_OP;}
-  void reset(){drop_list.empty();alter_list.empty();clear();}
-} ALTER_INFO;
+  Alter_info() :
+    flags(0),
+    keys_onoff(LEAVE_AS_IS),
+    tablespace_op(NO_TABLESPACE_OP)
+  {}
+
+  void reset()
+  {
+    drop_list.empty();
+    alter_list.empty();
+    key_list.empty();
+    create_list.empty();
+    flags= 0;
+    keys_onoff= LEAVE_AS_IS;
+    tablespace_op= NO_TABLESPACE_OP;
+  }
+  /**
+    Construct a copy of this object to be used for mysql_alter_table
+    and mysql_create_table. Historically, these two functions modify
+    their Alter_info arguments. This behaviour breaks re-execution of
+    prepared statements and stored procedures and is compensated by
+    always supplying a copy of Alter_info to these functions.
+    The constructed copy still shares key Key, Alter_drop, create_field
+    and Alter_column elements of the lists - these structures are not
+    modified and thus are not copied.
+
+    @note You need to use check thd->is_fatal_error for out
+    of memory condition after calling this function.
+  */
+  Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root);
+private:
+  Alter_info &operator=(const Alter_info &rhs); // not implemented
+  Alter_info(const Alter_info &rhs);            // not implemented
+};
 
 struct st_sp_chistics
 {
@@ -885,8 +924,6 @@
   List<String>	      interval_list;
   List<LEX_USER>      users_list;
   List<LEX_COLUMN>    columns;
-  List<Key>	      key_list;
-  List<create_field>  create_list;
   List<Item>	      *insert_list,field_list,value_list,update_list;
   List<List_item>     many_values;
   List<set_var_base>  var_list;
@@ -979,7 +1016,7 @@
   bool safe_to_cache_query;
   bool subqueries, ignore;
   st_parsing_options parsing_options;
-  ALTER_INFO alter_info;
+  Alter_info alter_info;
   /* Prepared statements SQL syntax:*/
   LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */
   /*

--- 1.96/sql/sql_string.cc	2007-01-09 18:06:54 +02:00
+++ 1.97/sql/sql_string.cc	2007-01-22 14:10:41 +02:00
@@ -1031,8 +1031,8 @@
     case '\r':
       str->append(STRING_WITH_LEN("\\r"));
       break;
-    case 26: //Ctrl-Z
-      str->append(STRING_WITH_LEN("\\z"));
+    case '\032': // Ctrl-Z
+      str->append(STRING_WITH_LEN("\\Z"));
       break;
     default:
       str->append(c);

--- 1.331/sql/sql_table.cc	2007-01-09 18:06:54 +02:00
+++ 1.332/sql/sql_table.cc	2007-01-22 14:10:42 +02:00
@@ -646,8 +646,7 @@
     mysql_prepare_table()
     thd			Thread object
     create_info		Create information (like MAX_ROWS)
-    fields		List of fields to create
-    keys		List of keys to create
+    alter_info          List of columns and indexes to create
 
   DESCRIPTION
     Prepares the table and key structures for table creation.
@@ -661,8 +660,8 @@
 */
 
 static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
-                               List<create_field> *fields,
-                               List<Key> *keys, bool tmp_table,
+                               Alter_info *alter_info,
+                               bool tmp_table,
                                uint *db_options,
                                handler *file, KEY **key_info_buffer,
                                uint *key_count, int select_field_count)
@@ -676,11 +675,12 @@
   int		timestamps= 0, timestamps_with_niladic= 0;
   int		field_no,dup_no;
   int		select_field_pos,auto_increment=0;
-  List_iterator<create_field> it(*fields),it2(*fields);
+  List_iterator<create_field> it(alter_info->create_list);
+  List_iterator<create_field> it2(alter_info->create_list);
   uint total_uneven_bit_length= 0;
   DBUG_ENTER("mysql_prepare_table");
 
-  select_field_pos= fields->elements - select_field_count;
+  select_field_pos= alter_info->create_list.elements - select_field_count;
   null_fields=blob_columns=0;
   create_info->varchar= 0;
   max_key_length= file->max_key_length();
@@ -1005,7 +1005,8 @@
 
   /* Create keys */
 
-  List_iterator<Key> key_iterator(*keys), key_iterator2(*keys);
+  List_iterator<Key> key_iterator(alter_info->key_list);
+  List_iterator<Key> key_iterator2(alter_info->key_list);
   uint key_parts=0, fk_key_count=0;
   bool primary_key=0,unique_key=0;
   Key *key, *key2;
@@ -1564,14 +1565,13 @@
 
   SYNOPSIS
     mysql_create_table()
-    thd			Thread object
-    db			Database
-    table_name		Table name
-    create_info		Create information (like MAX_ROWS)
-    fields		List of fields to create
-    keys		List of keys to create
-    internal_tmp_table  Set to 1 if this is an internal temporary table
-			(From ALTER TABLE)
+    thd                  Thread object
+    db                   Database
+    table_name           Table name
+    create_info [in/out] Create information (like MAX_ROWS)
+    alter_info  [in/out] List of columns and indexes to create
+    internal_tmp_table   Set to 1 if this is an internal temporary table
+                         (From ALTER TABLE)
 
   DESCRIPTION
     If one creates a temporary table, this is automatically opened
@@ -1581,6 +1581,11 @@
     select_field_count is also used for CREATE ... SELECT,
     and must be zero for standard create of table.
 
+    Note that structures passed as 'create_info' and 'alter_info' parameters
+    may be modified by this function. It is responsibility of the caller to
+    make a copy of create_info in order to provide correct execution in
+    prepared statements/stored routines.
+
   RETURN VALUES
     FALSE OK
     TRUE  error
@@ -1588,8 +1593,8 @@
 
 bool mysql_create_table(THD *thd,const char *db, const char *table_name,
                         HA_CREATE_INFO *create_info,
-                        List<create_field> &fields,
-                        List<Key> &keys,bool internal_tmp_table,
+                        Alter_info *alter_info,
+                        bool internal_tmp_table,
                         uint select_field_count)
 {
   char		path[FN_REFLEN];
@@ -1601,7 +1606,7 @@
   DBUG_ENTER("mysql_create_table");
 
   /* Check for duplicate fields and check type of table to create */
-  if (!fields.elements)
+  if (!alter_info->create_list.elements)
   {
     my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
                MYF(0));
@@ -1645,10 +1650,10 @@
     create_info->default_table_charset= db_info.default_table_charset;
   }
 
-  if (mysql_prepare_table(thd, create_info, &fields,
-			  &keys, internal_tmp_table, &db_options, file,
-			  &key_info_buffer, &key_count,
-			  select_field_count))
+  if (mysql_prepare_table(thd, create_info, alter_info, internal_tmp_table,
+                          &db_options, file,
+                          &key_info_buffer, &key_count,
+                          select_field_count))
     DBUG_RETURN(TRUE);
 
       /* Check if table exists */
@@ -1738,8 +1743,8 @@
   create_info->table_options=db_options;
 
   if (rea_create_table(thd, path, db, table_name,
-                       create_info, fields, key_count,
-		       key_info_buffer))
+                       create_info, alter_info->create_list,
+                       key_count, key_info_buffer))
     goto end;
   if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
   {
@@ -2327,9 +2332,12 @@
           (table->table->file->ha_check_for_upgrade(check_opt) ==
            HA_ADMIN_NEEDS_ALTER))
       {
+        my_bool save_no_send_ok= thd->net.no_send_ok;
         close_thread_tables(thd);
         tmp_disable_binlog(thd); // binlogging is done by caller if wanted
-        result_code= mysql_recreate_table(thd, table, 0);
+        thd->net.no_send_ok= TRUE;
+        result_code= mysql_recreate_table(thd, table);
+        thd->net.no_send_ok= save_no_send_ok;
         reenable_binlog(thd);
         goto send_result;
       }
@@ -2408,6 +2416,7 @@
 
     case HA_ADMIN_TRY_ALTER:
     {
+      my_bool save_no_send_ok= thd->net.no_send_ok;
       /*
         This is currently used only by InnoDB. ha_innobase::optimize() answers
         "try with alter", so here we close the table, do an ALTER TABLE,
@@ -2418,7 +2427,9 @@
                  *save_next_global= table->next_global;
       table->next_local= table->next_global= 0;
       tmp_disable_binlog(thd); // binlogging is done by caller if wanted
-      result_code= mysql_recreate_table(thd, table, 0);
+      thd->net.no_send_ok= TRUE;
+      result_code= mysql_recreate_table(thd, table);
+      thd->net.no_send_ok= save_no_send_ok;
       reenable_binlog(thd);
       close_thread_tables(thd);
       if (!result_code) // recreation went ok
@@ -2988,14 +2999,20 @@
 
 /*
   Alter table
+
+
+  NOTE
+    The structures passed as 'create_info' and 'alter_info' parameters may
+    be modified by this function. It is responsibility of the caller to make
+    a copy of create_info in order to provide correct execution in prepared
+    statements/stored routines.
 */
 
 bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
                        HA_CREATE_INFO *create_info,
                        TABLE_LIST *table_list,
-                       List<create_field> &fields, List<Key> &keys,
-                       uint order_num, ORDER *order, bool ignore,
-                       ALTER_INFO *alter_info, bool do_send_ok)
+                       Alter_info *alter_info,
+                       uint order_num, ORDER *order, bool ignore)
 {
   TABLE *table,*new_table=0;
   int error= 0;
@@ -3217,8 +3234,7 @@
 	Query_log_event qinfo(thd, thd->query, thd->query_length, FALSE, FALSE);
 	mysql_bin_log.write(&qinfo);
       }
-      if (do_send_ok)
-        send_ok(thd);
+      send_ok(thd);
     }
     else if (error > 0)
     {
@@ -3245,10 +3261,9 @@
 
   restore_record(table, s->default_values);     // Empty record for DEFAULT
   List_iterator<Alter_drop> drop_it(alter_info->drop_list);
-  List_iterator<create_field> def_it(fields);
+  List_iterator<create_field> def_it(alter_info->create_list);
   List_iterator<Alter_column> alter_it(alter_info->alter_list);
-  List<create_field> create_list;		// Add new fields here
-  List<Key> key_list;				// Add new keys here
+  Alter_info new_info;                   // Add new columns and indexes here
   create_field *def;
 
   /*
@@ -3296,13 +3311,13 @@
       def->field=field;
       if (!def->after)
       {
-	create_list.push_back(def);
+	new_info.create_list.push_back(def);
 	def_it.remove();
       }
     }
     else
     {						// Use old field value
-      create_list.push_back(def=new create_field(field,field));
+      new_info.create_list.push_back(def= new create_field(field, field));
       alter_it.rewind();			// Change default if ALTER
       Alter_column *alter;
       while ((alter=alter_it++))
@@ -3326,7 +3341,7 @@
     }
   }
   def_it.rewind();
-  List_iterator<create_field> find_it(create_list);
+  List_iterator<create_field> find_it(new_info.create_list);
   while ((def=def_it++))			// Add new columns
   {
     if (def->change && ! def->field)
@@ -3335,9 +3350,9 @@
       DBUG_RETURN(TRUE);
     }
     if (!def->after)
-      create_list.push_back(def);
+      new_info.create_list.push_back(def);
     else if (def->after == first_keyword)
-      create_list.push_front(def);
+      new_info.create_list.push_front(def);
     else
     {
       create_field *find;
@@ -3361,7 +3376,7 @@
              alter_info->alter_list.head()->name, table_name);
     DBUG_RETURN(TRUE);
   }
-  if (!create_list.elements)
+  if (!new_info.create_list.elements)
   {
     my_message(ER_CANT_REMOVE_ALL_FIELDS, ER(ER_CANT_REMOVE_ALL_FIELDS),
                MYF(0));
@@ -3373,8 +3388,8 @@
     for which some fields exists.
   */
 
-  List_iterator<Key> key_it(keys);
-  List_iterator<create_field> field_it(create_list);
+  List_iterator<Key> key_it(alter_info->key_list);
+  List_iterator<create_field> field_it(new_info.create_list);
   List<key_part_spec> key_parts;
 
   KEY *key_info=table->key_info;
@@ -3446,24 +3461,37 @@
 					    key_part_length));
     }
     if (key_parts.elements)
-      key_list.push_back(new Key(key_info->flags & HA_SPATIAL ? Key::SPATIAL :
-				 (key_info->flags & HA_NOSAME ?
-				 (!my_strcasecmp(system_charset_info,
-						 key_name, primary_key_name) ?
-				  Key::PRIMARY	: Key::UNIQUE) :
-				  (key_info->flags & HA_FULLTEXT ?
-				   Key::FULLTEXT : Key::MULTIPLE)),
-				 key_name,
-				 key_info->algorithm,
-                                 test(key_info->flags & HA_GENERATED_KEY),
-				 key_parts));
+    {
+      Key *key;
+      enum Key::Keytype key_type;
+
+      if (key_info->flags & HA_SPATIAL)
+        key_type= Key::SPATIAL;
+      else if (key_info->flags & HA_NOSAME)
+      {
+        if (! my_strcasecmp(system_charset_info, key_name, primary_key_name))
+          key_type= Key::PRIMARY;
+        else
+          key_type= Key::UNIQUE;
+      }
+      else if (key_info->flags & HA_FULLTEXT)
+        key_type= Key::FULLTEXT;
+      else
+        key_type= Key::MULTIPLE;
+
+      key= new Key(key_type, key_name,
+                   key_info->algorithm,
+                   test(key_info->flags & HA_GENERATED_KEY),
+                   key_parts);
+      new_info.key_list.push_back(key);
+    }
   }
   {
     Key *key;
     while ((key=key_it++))			// Add new keys
     {
       if (key->type != Key::FOREIGN_KEY)
-	key_list.push_back(key);
+        new_info.key_list.push_back(key);
       if (key->name &&
 	  !my_strcasecmp(system_charset_info,key->name,primary_key_name))
       {
@@ -3598,7 +3626,7 @@
   {
     tmp_disable_binlog(thd);
     error= mysql_create_table(thd, new_db, tmp_name,
-                              create_info,create_list,key_list,1,0);
+                              create_info, &new_info, 1, 0);
     reenable_binlog(thd);
     if (error)
       DBUG_RETURN(error);
@@ -3639,9 +3667,9 @@
   {
     new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
     new_table->next_number_field=new_table->found_next_number_field;
-    error=copy_data_between_tables(table, new_table, create_list, ignore,
-				   order_num, order, &copied, &deleted,
-                                   alter_info->keys_onoff);
+    error= copy_data_between_tables(table, new_table, new_info.create_list,
+                                    ignore, order_num, order,
+                                    &copied, &deleted, alter_info->keys_onoff);
   }
   else if (!new_table)
   {
@@ -3865,8 +3893,7 @@
   my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO),
 	      (ulong) (copied + deleted), (ulong) deleted,
 	      (ulong) thd->cuted_fields);
-  if (do_send_ok)
-    send_ok(thd,copied+deleted,0L,tmp_name);
+  send_ok(thd, copied + deleted, 0L, tmp_name);
   thd->some_tables_deleted=0;
   DBUG_RETURN(FALSE);
 
@@ -4065,31 +4092,26 @@
     mysql_recreate_table()
     thd			Thread handler
     tables		Tables to recreate
-    do_send_ok          If we should send_ok() or leave it to caller
 
  RETURN
     Like mysql_alter_table().
 */
-bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
-                          bool do_send_ok)
+bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list)
 {
-  DBUG_ENTER("mysql_recreate_table");
-  LEX *lex= thd->lex;
   HA_CREATE_INFO create_info;
-  lex->create_list.empty();
-  lex->key_list.empty();
-  lex->col_list.empty();
-  lex->alter_info.reset();
-  bzero((char*) &create_info,sizeof(create_info));
+  Alter_info alter_info;
+
+  DBUG_ENTER("mysql_recreate_table");
+
+  bzero((char*) &create_info, sizeof(create_info));
   create_info.db_type=DB_TYPE_DEFAULT;
   create_info.row_type=ROW_TYPE_NOT_USED;
   create_info.default_table_charset=default_charset_info;
   /* Force alter table to recreate table */
-  lex->alter_info.flags= ALTER_CHANGE_COLUMN;
+  alter_info.flags= ALTER_CHANGE_COLUMN;
   DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info,
-                                table_list, lex->create_list,
-                                lex->key_list, 0, (ORDER *) 0,
-                                0, &lex->alter_info, do_send_ok));
+                                table_list, &alter_info,
+                                0, (ORDER *) 0, 0));
 }
 
 

--- 1.500/sql/sql_yacc.yy	2007-01-09 18:06:55 +02:00
+++ 1.501/sql/sql_yacc.yy	2007-01-22 14:10:42 +02:00
@@ -95,6 +95,187 @@
 }
 #endif
 
+
+/**
+  Helper action for a case statement (entering the CASE).
+  This helper is used for both 'simple' and 'searched' cases.
+  This helper, with the other case_stmt_action_..., is executed when
+  the following SQL code is parsed:
+<pre>
+CREATE PROCEDURE proc_19194_simple(i int)
+BEGIN
+  DECLARE str CHAR(10);
+
+  CASE i
+    WHEN 1 THEN SET str="1";
+    WHEN 2 THEN SET str="2";
+    WHEN 3 THEN SET str="3";
+    ELSE SET str="unknown";
+  END CASE;
+
+  SELECT str;
+END
+</pre>
+  The actions are used to generate the following code:
+<pre>
+SHOW PROCEDURE CODE proc_19194_simple;
+Pos     Instruction
+0       set str@1 NULL
+1       set_case_expr (12) 0 i@0
+2       jump_if_not 5(12) (case_expr@0 = 1)
+3       set str@1 _latin1'1'
+4       jump 12
+5       jump_if_not 8(12) (case_expr@0 = 2)
+6       set str@1 _latin1'2'
+7       jump 12
+8       jump_if_not 11(12) (case_expr@0 = 3)
+9       set str@1 _latin1'3'
+10      jump 12
+11      set str@1 _latin1'unknown'
+12      stmt 0 "SELECT str"
+</pre>
+
+  @param lex the parser lex context
+*/
+
+void case_stmt_action_case(LEX *lex)
+{
+  lex->sphead->new_cont_backpatch(NULL);
+
+  /*
+    BACKPATCH: Creating target label for the jump to
+    "case_stmt_action_end_case"
+    (Instruction 12 in the example)
+  */
+
+  lex->spcont->push_label((char *)"", lex->sphead->instructions());
+}
+
+/**
+  Helper action for a case expression statement (the expr in 'CASE expr').
+  This helper is used for 'searched' cases only.
+  @param lex the parser lex context
+  @param expr the parsed expression
+  @return 0 on success
+*/
+
+int case_stmt_action_expr(LEX *lex, Item* expr)
+{
+  sp_head *sp= lex->sphead;
+  sp_pcontext *parsing_ctx= lex->spcont;
+  int case_expr_id= parsing_ctx->register_case_expr();
+  sp_instr_set_case_expr *i;
+
+  if (parsing_ctx->push_case_expr_id(case_expr_id))
+    return 1;
+
+  i= new sp_instr_set_case_expr(sp->instructions(),
+                                parsing_ctx, case_expr_id, expr, lex);
+
+  sp->add_cont_backpatch(i);
+  sp->add_instr(i);
+
+  return 0;
+}
+
+/**
+  Helper action for a case when condition.
+  This helper is used for both 'simple' and 'searched' cases.
+  @param lex the parser lex context
+  @param when the parsed expression for the WHEN clause
+  @param simple true for simple cases, false for searched cases
+*/
+
+void case_stmt_action_when(LEX *lex, Item *when, bool simple)
+{
+  sp_head *sp= lex->sphead;
+  sp_pcontext *ctx= lex->spcont;
+  uint ip= sp->instructions();
+  sp_instr_jump_if_not *i;
+  Item_case_expr *var;
+  Item *expr;
+
+  if (simple)
+  {
+    var= new Item_case_expr(ctx->get_current_case_expr_id());
+
+#ifndef DBUG_OFF
+    if (var)
+    {
+      var->m_sp= sp;
+    }
+#endif
+
+    expr= new Item_func_eq(var, when);
+    i= new sp_instr_jump_if_not(ip, ctx, expr, lex);
+  }
+  else
+    i= new sp_instr_jump_if_not(ip, ctx, when, lex);
+
+  /*
+    BACKPATCH: Registering forward jump from
+    "case_stmt_action_when" to "case_stmt_action_then"
+    (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
+  */
+
+  sp->push_backpatch(i, ctx->push_label((char *)"", 0));
+  sp->add_cont_backpatch(i);
+  sp->add_instr(i);
+}
+
+/**
+  Helper action for a case then statements.
+  This helper is used for both 'simple' and 'searched' cases.
+  @param lex the parser lex context
+*/
+
+void case_stmt_action_then(LEX *lex)
+{
+  sp_head *sp= lex->sphead;
+  sp_pcontext *ctx= lex->spcont;
+  uint ip= sp->instructions();
+  sp_instr_jump *i = new sp_instr_jump(ip, ctx);
+  sp->add_instr(i);
+
+  /*
+    BACKPATCH: Resolving forward jump from
+    "case_stmt_action_when" to "case_stmt_action_then"
+    (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
+  */
+
+  sp->backpatch(ctx->pop_label());
+
+  /*
+    BACKPATCH: Registering forward jump from
+    "case_stmt_action_then" to "case_stmt_action_end_case"
+    (jump from instruction 4 to 12, 7 to 12 ... in the example)
+  */
+
+  sp->push_backpatch(i, ctx->last_label());
+}
+
+/**
+  Helper action for an end case.
+  This helper is used for both 'simple' and 'searched' cases.
+  @param lex the parser lex context
+  @param simple true for simple cases, false for searched cases
+*/
+
+void case_stmt_action_end_case(LEX *lex, bool simple)
+{
+  /*
+    BACKPATCH: Resolving forward jump from
+    "case_stmt_action_then" to "case_stmt_action_end_case"
+    (jump from instruction 4 to 12, 7 to 12 ... in the example)
+  */
+  lex->sphead->backpatch(lex->spcont->pop_label());
+
+  if (simple)
+    lex->spcont->pop_case_expr_id();
+
+  lex->sphead->do_cont_backpatch();
+}
+
 %}
 %union {
   int  num;
@@ -831,7 +1012,7 @@
 	select_item_list select_item values_list no_braces
 	opt_limit_clause delete_limit_clause fields opt_values values
 	procedure_list procedure_list2 procedure_item
-	when_list2 expr_list2 udf_expr_list3 handler
+	expr_list2 udf_expr_list3 handler
 	opt_precision opt_ignore opt_column opt_restrict
 	grant revoke set lock unlock string_list field_options field_option
 	field_opt_list opt_binary table_lock_list table_lock
@@ -859,6 +1040,7 @@
         view_algorithm view_or_trigger_or_sp view_or_trigger_or_sp_tail
 	view_suid view_tail view_list_opt view_list view_select
 	view_check_option trigger_tail sp_tail
+        case_stmt_specification simple_case_stmt searched_case_stmt
 END_OF_INPUT
 
 %type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
@@ -1170,8 +1352,7 @@
 						  TL_READ_NO_INSERT:
 						  TL_READ)))
 	    YYABORT;
-	  lex->create_list.empty();
-	  lex->key_list.empty();
+          lex->alter_info.reset();
 	  lex->col_list.empty();
 	  lex->change=NullS;
 	  bzero((char*) &lex->create_info,sizeof(lex->create_info));
@@ -1189,16 +1370,17 @@
 	    if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL,
 							TL_OPTION_UPDATING))
 	      YYABORT;
-	    lex->create_list.empty();
-	    lex->key_list.empty();
+            lex->alter_info.reset();
+            lex->alter_info.flags= ALTER_ADD_INDEX;
 	    lex->col_list.empty();
 	    lex->change=NullS;
 	  }
 	   '(' key_list ')'
 	  {
 	    LEX *lex=Lex;
+            Key *key= new Key($2, $4.str, $5, 0, lex->col_list);
 
-	    lex->key_list.push_back(new Key($2,$4.str, $5, 0, lex->col_list));
+            lex->alter_info.key_list.push_back(key);
 	    lex->col_list.empty();
 	  }
 	| CREATE DATABASE opt_if_not_exists ident
@@ -1993,43 +2175,7 @@
           { Lex->sphead->new_cont_backpatch(NULL); }
           sp_if END IF
           { Lex->sphead->do_cont_backpatch(); }
-	| CASE_SYM WHEN_SYM
-	  {
-	    Lex->sphead->m_flags&= ~sp_head::IN_SIMPLE_CASE;
-            Lex->sphead->new_cont_backpatch(NULL);
-	  }
-          sp_case END CASE_SYM { Lex->sphead->do_cont_backpatch(); }
-        | CASE_SYM
-          {
-            Lex->sphead->reset_lex(YYTHD);
-            Lex->sphead->new_cont_backpatch(NULL);
-          }
-          expr WHEN_SYM
-	  {
-	    LEX *lex= Lex;
-	    sp_head *sp= lex->sphead;
-	    sp_pcontext *parsing_ctx= lex->spcont;
-	    int case_expr_id= parsing_ctx->register_case_expr();
-            sp_instr_set_case_expr *i;
-	    
-	    if (parsing_ctx->push_case_expr_id(case_expr_id))
-              YYABORT;
-
-            i= new sp_instr_set_case_expr(sp->instructions(),
-                                          parsing_ctx,
-                                          case_expr_id,
-                                          $3,
-                                          lex);
-            sp->add_cont_backpatch(i);
-            sp->add_instr(i);
-	    sp->m_flags|= sp_head::IN_SIMPLE_CASE;
-	    sp->restore_lex(YYTHD);
-	  }
-	  sp_case END CASE_SYM
-	  {
-	    Lex->spcont->pop_case_expr_id();
-            Lex->sphead->do_cont_backpatch();
-	  }
+        | case_stmt_specification
 	| sp_labeled_control
 	  {}
 	| { /* Unlabeled controls get a secret label. */
@@ -2240,72 +2386,114 @@
 	| ELSE sp_proc_stmts1
 	;
 
-sp_case:
-	  { Lex->sphead->reset_lex(YYTHD); }
-          expr THEN_SYM
-	  {
-            LEX *lex= Lex;
-	    sp_head *sp= lex->sphead;
-	    sp_pcontext *ctx= Lex->spcont;
-	    uint ip= sp->instructions();
-	    sp_instr_jump_if_not *i;
-
-	    if (! (sp->m_flags & sp_head::IN_SIMPLE_CASE))
-	      i= new sp_instr_jump_if_not(ip, ctx, $2, lex);
-	    else
-	    { /* Simple case: <caseval> = <whenval> */
+case_stmt_specification:
+          simple_case_stmt
+        | searched_case_stmt
+        ;
 
-	      Item_case_expr *var;
-              Item *expr;
+simple_case_stmt:
+          CASE_SYM
+          {
+            LEX *lex= Lex;
+            case_stmt_action_case(lex);
+            lex->sphead->reset_lex(YYTHD); /* For expr $3 */
+          }
+          expr
+          {
+            LEX *lex= Lex;
+            if (case_stmt_action_expr(lex, $3))
+              YYABORT;
 
-              var= new Item_case_expr(ctx->get_current_case_expr_id());
+            lex->sphead->restore_lex(YYTHD); /* For expr $3 */
+          }
+          simple_when_clause_list
+          else_clause_opt
+          END
+          CASE_SYM
+          {
+            LEX *lex= Lex;
+            case_stmt_action_end_case(lex, true);
+          }
+        ;
 
-#ifndef DBUG_OFF
-              if (var)
-                var->m_sp= sp;
-#endif
+searched_case_stmt:
+          CASE_SYM
+          {
+            LEX *lex= Lex;
+            case_stmt_action_case(lex);
+          }
+          searched_when_clause_list
+          else_clause_opt
+          END
+          CASE_SYM
+          {
+            LEX *lex= Lex;
+            case_stmt_action_end_case(lex, false);
+          }
+        ;
 
-	      expr= new Item_func_eq(var, $2);
+simple_when_clause_list:
+          simple_when_clause
+        | simple_when_clause_list simple_when_clause
+        ;
 
-	      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);
-	  }
-	  sp_proc_stmts1
-	  {
-	    sp_head *sp= Lex->sphead;
-	    sp_pcontext *ctx= Lex->spcont;
-	    uint ip= sp->instructions();
-	    sp_instr_jump *i = new sp_instr_jump(ip, ctx);
+searched_when_clause_list:
+          searched_when_clause
+        | searched_when_clause_list searched_when_clause
+        ;
 
-	    sp->add_instr(i);
-	    sp->backpatch(ctx->pop_label());
-	    sp->push_backpatch(i, ctx->push_label((char *)"", 0));
-	  }
-	  sp_whens
-	  {
-	    LEX *lex= Lex;
+simple_when_clause:
+          WHEN_SYM
+          {
+            Lex->sphead->reset_lex(YYTHD); /* For expr $3 */
+          }
+          expr
+          {
+            /* Simple case: <caseval> = <whenval> */
 
-	    lex->sphead->backpatch(lex->spcont->pop_label());
-	  }
-	;
+            LEX *lex= Lex;
+            case_stmt_action_when(lex, $3, true);
+            lex->sphead->restore_lex(YYTHD); /* For expr $3 */
+          }
+          THEN_SYM
+          sp_proc_stmts1
+          {
+            LEX *lex= Lex;
+            case_stmt_action_then(lex);
+          }
+        ;
 
-sp_whens:
-	  /* Empty */
-	  {
-	    sp_head *sp= Lex->sphead;
-	    uint ip= sp->instructions();
-	    sp_instr_error *i= new sp_instr_error(ip, Lex->spcont,
-						  ER_SP_CASE_NOT_FOUND);
+searched_when_clause:
+          WHEN_SYM
+          {
+            Lex->sphead->reset_lex(YYTHD); /* For expr $3 */
+          }
+          expr
+          {
+            LEX *lex= Lex;
+            case_stmt_action_when(lex, $3, false);
+            lex->sphead->restore_lex(YYTHD); /* For expr $3 */
+          }
+          THEN_SYM
+          sp_proc_stmts1
+          {
+            LEX *lex= Lex;
+            case_stmt_action_then(lex);
+          }
+        ;
 
-	    sp->add_instr(i);
-	  }
-	| ELSE sp_proc_stmts1 {}
-	| WHEN_SYM sp_case {}
-	;
+else_clause_opt:
+          /* empty */
+          {
+            LEX *lex= Lex;
+            sp_head *sp= lex->sphead;
+            uint ip= sp->instructions();
+            sp_instr_error *i= new sp_instr_error(ip, lex->spcont,
+                                                  ER_SP_CASE_NOT_FOUND);
+            sp->add_instr(i);
+          }
+        | ELSE sp_proc_stmts1
+        ;
 
 sp_labeled_control:
 	  label_ident ':'
@@ -2732,29 +2920,34 @@
 	key_type opt_ident key_alg '(' key_list ')'
 	  {
 	    LEX *lex=Lex;
-	    lex->key_list.push_back(new Key($1,$2, $3, 0, lex->col_list));
+            Key *key= new Key($1, $2, $3, 0, lex->col_list);
+            lex->alter_info.key_list.push_back(key);
+
 	    lex->col_list.empty();		/* Alloced by sql_alloc */
 	  }
 	| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')'
 	  {
 	    LEX *lex=Lex;
 	    const char *key_name= $3 ? $3:$1;
-	    lex->key_list.push_back(new Key($2, key_name, $4, 0,
-				    lex->col_list));
+            Key *key= new Key($2, key_name, $4, 0, lex->col_list);
+            lex->alter_info.key_list.push_back(key);
 	    lex->col_list.empty();		/* Alloced by sql_alloc */
 	  }
 	| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
 	  {
 	    LEX *lex=Lex;
-	    lex->key_list.push_back(new foreign_key($4 ? $4:$1, lex->col_list,
-				    $8,
-				    lex->ref_list,
-				    lex->fk_delete_opt,
-				    lex->fk_update_opt,
-				    lex->fk_match_option));
-	    lex->key_list.push_back(new Key(Key::MULTIPLE, $4 ? $4 : $1,
-					    HA_KEY_ALG_UNDEF, 1,
-					    lex->col_list));
+            const char *key_name= $4 ? $4 : $1;
+            Key *key= new foreign_key(key_name, lex->col_list,
+                                      $8,
+                                      lex->ref_list,
+                                      lex->fk_delete_opt,
+                                      lex->fk_update_opt,
+                                      lex->fk_match_option);
+            lex->alter_info.key_list.push_back(key);
+            key= new Key(Key::MULTIPLE, key_name,
+                         HA_KEY_ALG_UNDEF, 1,
+                         lex->col_list);
+            lex->alter_info.key_list.push_back(key);
 	    lex->col_list.empty();		/* Alloced by sql_alloc */
 	  }
 	| constraint opt_check_constraint
@@ -3296,8 +3489,6 @@
 	  if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
 						 TL_OPTION_UPDATING))
 	    YYABORT;
-	  lex->create_list.empty();
-	  lex->key_list.empty();
 	  lex->col_list.empty();
           lex->select_lex.init_order();
 	  lex->select_lex.db=
@@ -3307,8 +3498,7 @@
 	  lex->create_info.db_type= DB_TYPE_DEFAULT;
 	  lex->create_info.default_table_charset= NULL;
 	  lex->create_info.row_type= ROW_TYPE_NOT_USED;
-	  lex->alter_info.reset();
-	  lex->alter_info.flags= 0;
+          lex->alter_info.reset();
 	}
 	alter_list
 	{}
@@ -4372,8 +4562,8 @@
             if (!$$)
               YYABORT;
 	  }
-	| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
-	  { $$= new Item_func_case(* $4, $2, $5 ); }
+	| CASE_SYM opt_expr when_list opt_else END
+	  { $$= new Item_func_case(* $3, $2, $4 ); }
 	| CONVERT_SYM '(' expr ',' cast_type ')'
 	  {
 	    $$= create_func_cast($3, $5,
@@ -5181,23 +5371,19 @@
 	| ELSE expr    { $$= $2; };
 
 when_list:
-        { Select->when_list.push_front(new List<Item>); }
-	when_list2
-	{ $$= Select->when_list.pop(); };
-
-when_list2:
-	expr THEN_SYM expr
-	  {
-	    SELECT_LEX *sel=Select;
-	    sel->when_list.head()->push_back($1);
-	    sel->when_list.head()->push_back($3);
-	}
-	| when_list2 WHEN_SYM expr THEN_SYM expr
-	  {
-	    SELECT_LEX *sel=Select;
-	    sel->when_list.head()->push_back($3);
-	    sel->when_list.head()->push_back($5);
-	  };
+          WHEN_SYM expr THEN_SYM expr
+          {
+            $$= new List<Item>;
+            $$->push_back($2);
+            $$->push_back($4);
+          }
+        | when_list WHEN_SYM expr THEN_SYM expr
+          {
+            $1->push_back($3);
+            $1->push_back($5);
+            $$= $1;
+          }
+        ;
 
 /* Warning - may return NULL in case of incomplete SELECT */
 table_ref:
@@ -6066,7 +6252,8 @@
 	  {
 	     LEX *lex=Lex;
 	     lex->sql_command= SQLCOM_DROP_INDEX;
-	     lex->alter_info.drop_list.empty();
+             lex->alter_info.reset();
+             lex->alter_info.flags= ALTER_DROP_INDEX;
 	     lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY,
                                                                 $3.str));
 	     if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,

--- 1.16/client/mysql_upgrade.c	2007-01-09 18:06:41 +02:00
+++ 1.17/client/mysql_upgrade.c	2007-01-22 14:10:36 +02:00
@@ -470,7 +470,12 @@
   
   load_defaults("my", load_default_groups, &argc, &argv);
 
-  if (handle_options(&argc, &argv, my_long_options, get_one_option)) 
+  /* 
+     Must init_dynamic_string before handle_options because string is freed
+     at error label.
+   */
+  if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN) ||
+      handle_options(&argc, &argv, my_long_options, get_one_option))
   {
     ret= 1;
     goto error;
@@ -478,11 +483,6 @@
   if (tty_password)
     opt_password= get_tty_password(NullS);
 
-  if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN))
-  {
-    ret= 1;
-    goto error;
-  }
   if (!basedir)
   {
     my_getwd(path, sizeof(path), MYF(0));
@@ -565,17 +565,34 @@
      goto error;
   }
   else
-    dynstr_set(&cmdline, path);
+  {
+#ifdef __WIN__
+    /* Windows requires an extra pair of quotes around the entire string. */
+    dynstr_set(&cmdline, "\""); 
+#else
+    dynstr_set(&cmdline, "");
+#endif /* __WIN__ */
+    dynstr_append_os_quoted(&cmdline, path, NullS);
+  }
 
   if (defaults_to_use)
   {
-    dynstr_append(&cmdline, " --defaults-extra-file=");
-    dynstr_append(&cmdline, defaults_to_use);
-  }
-  
-  dynstr_append(&cmdline, " --check-upgrade --all-databases"
-                 " --auto-repair --user=");
-  dynstr_append(&cmdline, user);
+    dynstr_append(&cmdline, " ");
+    dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=", 
+                            defaults_to_use, NullS);
+  }
+
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--check-upgrade", NullS);
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--all-databases", NullS);
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--auto-repair", NullS);
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--user=", user, NullS);
+#ifdef __WIN__
+  dynstr_append(&cmdline, "\"");
+#endif /* __WIN__ */
 
   if (opt_verbose)
     printf("Running %s\n", cmdline.str);
@@ -604,7 +621,15 @@
     goto error;
   }
   else
-    dynstr_set(&cmdline, path);
+  {
+#ifdef __WIN__
+    /* Windows requires an extra pair of quotes around the entire string. */
+    dynstr_set(&cmdline, "\"");
+#else
+    dynstr_set(&cmdline, "");
+#endif /* __WIN__ */
+    dynstr_append_os_quoted(&cmdline, path, NullS);
+  }
 
   if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0), 
                           path, sizeof(path), 
@@ -626,13 +651,25 @@
 
   if (defaults_to_use)
   {
-    dynstr_append(&cmdline, " --defaults-extra-file=");
-    dynstr_append(&cmdline, defaults_to_use);
-  }
-  dynstr_append(&cmdline, " --force --no-auto-rehash --batch --user=");
-  dynstr_append(&cmdline, user);
-  dynstr_append(&cmdline, " mysql < ");
-  dynstr_append(&cmdline, script_line);
+    dynstr_append(&cmdline, " ");
+    dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=", 
+                            defaults_to_use, NullS);
+  }
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--force", NullS);
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--no-auto-rehash", NullS);
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--batch", NullS);
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--user=", user, NullS);
+  dynstr_append(&cmdline, " ");
+  dynstr_append_os_quoted(&cmdline, "--database=mysql", NullS);
+  dynstr_append(&cmdline, " < ");
+  dynstr_append_os_quoted(&cmdline, script_line, NullS);
+#ifdef __WIN__
+  dynstr_append(&cmdline, "\"");
+#endif /* __WIN__ */
 
   if (opt_verbose)
     printf("Running %s\n", cmdline.str);

--- 1.190/sql/sql_prepare.cc	2007-01-11 17:42:44 +02:00
+++ 1.191/sql/sql_prepare.cc	2007-01-22 14:10:41 +02:00
@@ -2903,10 +2903,9 @@
     in INSERT ... SELECT and similar commands.
   */
 
-  if (open_cursor && lex->result && !lex->result->simple_select())
+  if (open_cursor && lex->result && lex->result->check_simple_select())
   {
     DBUG_PRINT("info",("Cursor asked for not SELECT stmt"));
-    my_error(ER_SP_BAD_CURSOR_QUERY, MYF(0));
     return TRUE;
   }
 
Thread
bk commit into 5.0 tree (monty:1.2384)monty22 Jan