mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
f3e4ce926d
into mysql.com:/home/kent/bk/main/mysql-5.1 BUILD/Makefile.am: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~10: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~11: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~12: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~13: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~14: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~15: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~1: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~2f6eabb2f69cb33d: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~2: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~3: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~4ef559bc8b4695f7: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~4: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~5: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~6: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~7: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~84669765249a4bad: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~8: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~9: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~c20dcd005f596740: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~dd682cce1d53c0b4: Auto merged BitKeeper/deleted/.del-Makefile.am~2: Auto merged BitKeeper/deleted/.del-Makefile.am~ab5c84d46412dc2e: Auto merged BitKeeper/deleted/.del-Makefile.am~de166d6fcac3b9b6: Auto merged BitKeeper/deleted/.del-Makefile.am~e5b911533dad2713: Auto merged BitKeeper/deleted/.del-Makefile.am~ead19441cc5ff35c: Auto merged BitKeeper/deleted/.del-Makefile.am~f87185e232d7c4f: Auto merged BitKeeper/deleted/.del-Makefile.in: Auto merged BitKeeper/deleted/.del-ReadMe.txt~573b1e4ebab241e1: Auto merged BitKeeper/deleted/.del-build-vs71.bat: Auto merged BitKeeper/deleted/.del-build-vs8.bat: Auto merged BitKeeper/deleted/.del-configure.js: Auto merged BitKeeper/deleted/.del-copy_mysql_files.bat~f6878eeb80173de9: Auto merged BitKeeper/deleted/.del-ha_berkeley.cc: Auto merged BitKeeper/deleted/.del-ha_berkeley.h: Auto merged BitKeeper/deleted/.del-make_win_bin_dist: Auto merged BitKeeper/deleted/.del-make_win_src_distribution.sh~f80d8fca44e4e5f1: Auto merged BitKeeper/deleted/.del-my_create_tables.c~c121a0c4c427ebb: Auto merged BitKeeper/deleted/.del-mysql_explain_log.sh~5ddc62808e16bd57: Auto merged BitKeeper/deleted/.del-mysql_thr.c~20772782813d1274: Auto merged BitKeeper/deleted/.del-mysql_upgrade.sh~826da969ccf96ef: Auto merged BitKeeper/deleted/.del-mysqlmanager.c~e97636d71145a0b: Auto merged BitKeeper/deleted/.del-prepare~773a10a535120a7e: Auto merged BitKeeper/deleted/.del-print-limit-table~b8e808031daa3758: Auto merged BitKeeper/deleted/.del-sql_manager.h: Auto merged BitKeeper/deleted/.del-thr_test.c~70fc0971c72f2a95: Auto merged Docs/Makefile.am: Auto merged Docs/generate-text-files.pl: Auto merged client/Makefile.am: Auto merged client/client_priv.h: Auto merged client/mysqladmin.cc: Auto merged client/mysqlimport.c: Auto merged client/mysqlshow.c: Auto merged dbug/Makefile.am: Auto merged extra/Makefile.am: Auto merged extra/yassl/taocrypt/benchmark/Makefile.am: Auto merged extra/yassl/taocrypt/test/Makefile.am: Auto merged include/Makefile.am: Auto merged include/my_time.h: Auto merged libmysql/Makefile.am: Auto merged libmysql_r/Makefile.am: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/embedded_priv.h: Auto merged mysql-test/Makefile.am: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/lib/mtr_cases.pl: Auto merged mysql-test/lib/mtr_io.pl: Auto merged mysql-test/lib/mtr_match.pl: Auto merged mysql-test/lib/mtr_misc.pl: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/lib/mtr_report.pl: Auto merged mysql-test/lib/mtr_timer.pl: Auto merged mysql-test/ndb/ndbcluster.sh: Auto merged mysys/Makefile.am: Auto merged mysys/my_gethostbyname.c: Auto merged mysys/my_getopt.c: Auto merged mysys/my_handler.c: Auto merged regex/Makefile.am: Auto merged scripts/Makefile.am: Auto merged scripts/fill_func_tables.sh: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_convert_table_format.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sh: Auto merged scripts/mysql_install_db.sh: Auto merged server-tools/instance-manager/IMService.cpp: Auto merged server-tools/instance-manager/WindowsService.cpp: Auto merged server-tools/instance-manager/listener.cc: Auto merged server-tools/instance-manager/log.cc: Auto merged server-tools/instance-manager/log.h: Auto merged server-tools/instance-manager/manager.cc: Auto merged server-tools/instance-manager/messages.cc: Auto merged server-tools/instance-manager/mysql_connection.cc: Auto merged server-tools/instance-manager/mysqlmanager.cc: Auto merged server-tools/instance-manager/options.cc: Auto merged server-tools/instance-manager/options.h: Auto merged server-tools/instance-manager/portability.h: Auto merged server-tools/instance-manager/priv.cc: Auto merged server-tools/instance-manager/protocol.cc: Auto merged server-tools/instance-manager/protocol.h: Auto merged server-tools/instance-manager/thread_registry.cc: Auto merged server-tools/instance-manager/thread_registry.h: Auto merged server-tools/instance-manager/user_map.cc: Auto merged server-tools/instance-manager/user_map.h: Auto merged sql/Makefile.am: Auto merged sql/discover.cc: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/filesort.cc: Auto merged sql/gen_lex_hash.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/hostname.cc: Auto merged sql/init.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.h: Auto merged sql/item_geofunc.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.h: Auto merged sql/item_uniq.cc: Auto merged sql/key.cc: Auto merged sql/lex_symbol.h: Auto merged sql/lock.cc: Auto merged sql/log_event.h: Auto merged sql/my_decimal.cc: Auto merged sql/my_decimal.h: Auto merged sql/my_lock.c: Auto merged sql/opt_range.cc: Auto merged sql/opt_range.h: Auto merged sql/password.c: Auto merged sql/procedure.h: Auto merged sql/protocol.h: Auto merged sql/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.h: Auto merged sql/spatial.h: Auto merged sql/sql_acl.h: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_analyse.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_crypt.cc: Auto merged sql/sql_cursor.cc: Auto merged sql/sql_do.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_manager.cc: Auto merged sql/sql_map.cc: Auto merged sql/sql_olap.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_repl.h: Auto merged sql-bench/Makefile.am: Auto merged sql-bench/as3ap.sh: Auto merged sql-bench/bench-count-distinct.sh: Auto merged sql-bench/bench-init.pl.sh: Auto merged sql-bench/compare-results.sh: Auto merged sql-bench/copy-db.sh: Auto merged sql-bench/crash-me.sh: Auto merged sql-bench/run-all-tests.sh: Auto merged sql-bench/server-cfg.sh: Auto merged sql-bench/test-ATIS.sh: Auto merged sql-bench/test-alter-table.sh: Auto merged sql-bench/test-big-tables.sh: Auto merged sql-bench/test-connect.sh: Auto merged sql-bench/test-create.sh: Auto merged sql-bench/test-insert.sh: Auto merged sql-bench/test-select.sh: Auto merged sql-bench/test-transactions.sh: Auto merged sql-bench/test-wisconsin.sh: Auto merged sql-common/my_time.c: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_test.cc: Auto merged sql/sql_update.cc: Auto merged sql/structs.h: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/time.cc: Auto merged sql/unireg.cc: Auto merged sql/unireg.h: Auto merged storage/federated/ha_federated.cc: Auto merged storage/heap/Makefile.am: Auto merged storage/heap/_check.c: Auto merged storage/heap/_rectest.c: Auto merged storage/heap/ha_heap.cc: Auto merged storage/heap/ha_heap.h: Auto merged storage/heap/heapdef.h: Auto merged storage/heap/hp_block.c: Auto merged storage/heap/hp_clear.c: Auto merged storage/heap/hp_close.c: Auto merged storage/heap/hp_create.c: Auto merged storage/heap/hp_delete.c: Auto merged storage/heap/hp_extra.c: Auto merged storage/heap/hp_hash.c: Auto merged storage/heap/hp_info.c: Auto merged storage/heap/hp_open.c: Auto merged storage/heap/hp_panic.c: Auto merged storage/heap/hp_rename.c: Auto merged storage/heap/hp_rfirst.c: Auto merged storage/heap/hp_rkey.c: Auto merged storage/heap/hp_rlast.c: Auto merged storage/heap/hp_rnext.c: Auto merged storage/heap/hp_rprev.c: Auto merged storage/heap/hp_rrnd.c: Auto merged storage/heap/hp_rsame.c: Auto merged storage/heap/hp_scan.c: Auto merged storage/heap/hp_static.c: Auto merged storage/heap/hp_test1.c: Auto merged storage/heap/hp_test2.c: Auto merged storage/heap/hp_update.c: Auto merged storage/heap/hp_write.c: Auto merged storage/innobase/Makefile.am: Auto merged storage/innobase/btr/Makefile.am: Auto merged storage/innobase/buf/Makefile.am: Auto merged storage/innobase/data/Makefile.am: Auto merged storage/innobase/dict/Makefile.am: Auto merged storage/innobase/dyn/Makefile.am: Auto merged storage/innobase/eval/Makefile.am: Auto merged storage/innobase/fil/Makefile.am: Auto merged storage/innobase/fsp/Makefile.am: Auto merged storage/innobase/fut/Makefile.am: Auto merged storage/innobase/ha/Makefile.am: Auto merged storage/innobase/ibuf/Makefile.am: Auto merged storage/innobase/lock/Makefile.am: Auto merged storage/innobase/log/Makefile.am: Auto merged storage/innobase/mach/Makefile.am: Auto merged storage/innobase/mem/Makefile.am: Auto merged storage/innobase/mtr/Makefile.am: Auto merged storage/innobase/os/Makefile.am: Auto merged storage/innobase/page/Makefile.am: Auto merged storage/innobase/pars/Makefile.am: Auto merged storage/innobase/que/Makefile.am: Auto merged storage/innobase/read/Makefile.am: Auto merged storage/innobase/rem/Makefile.am: Auto merged storage/innobase/row/Makefile.am: Auto merged storage/innobase/srv/Makefile.am: Auto merged storage/innobase/sync/Makefile.am: Auto merged storage/innobase/thr/Makefile.am: Auto merged storage/innobase/trx/Makefile.am: Auto merged storage/innobase/usr/Makefile.am: Auto merged storage/innobase/ut/Makefile.am: Auto merged storage/myisam/Makefile.am: Auto merged storage/myisam/ft_boolean_search.c: Auto merged storage/myisam/ft_eval.c: Auto merged storage/myisam/ft_nlq_search.c: Auto merged storage/myisam/ft_parser.c: Auto merged storage/myisam/ft_static.c: Auto merged storage/myisam/ft_stem.c: Auto merged storage/myisam/ft_stopwords.c: Auto merged storage/myisam/ft_test1.c: Auto merged storage/myisam/ft_test1.h: Auto merged storage/myisam/ft_update.c: Auto merged storage/myisam/ftdefs.h: Auto merged storage/myisam/fulltext.h: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/ha_myisam.h: Auto merged storage/myisam/mi_cache.c: Auto merged storage/myisam/mi_changed.c: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_checksum.c: Auto merged storage/myisam/mi_close.c: Auto merged storage/myisam/mi_create.c: Auto merged storage/myisam/mi_dbug.c: Auto merged storage/myisam/mi_delete.c: Auto merged storage/myisam/mi_delete_all.c: Auto merged storage/myisam/mi_delete_table.c: Auto merged storage/myisam/mi_dynrec.c: Auto merged storage/myisam/mi_extra.c: Auto merged storage/myisam/mi_info.c: Auto merged storage/myisam/mi_key.c: Auto merged storage/myisam/mi_locking.c: Auto merged storage/myisam/mi_log.c: Auto merged storage/myisam/mi_open.c: Auto merged storage/myisam/mi_packrec.c: Auto merged storage/myisam/mi_page.c: Auto merged storage/myisam/mi_panic.c: Auto merged storage/myisam/mi_preload.c: Auto merged storage/myisam/mi_range.c: Auto merged storage/myisam/mi_rename.c: Auto merged storage/myisam/mi_rfirst.c: Auto merged storage/myisam/mi_rkey.c: Auto merged storage/myisam/mi_rlast.c: Auto merged storage/myisam/mi_rnext.c: Auto merged storage/myisam/mi_rnext_same.c: Auto merged storage/myisam/mi_rprev.c: Auto merged storage/myisam/mi_rrnd.c: Auto merged storage/myisam/mi_rsame.c: Auto merged storage/myisam/mi_rsamepos.c: Auto merged storage/myisam/mi_scan.c: Auto merged storage/myisam/mi_search.c: Auto merged storage/myisam/mi_static.c: Auto merged storage/myisam/mi_statrec.c: Auto merged storage/myisam/mi_test1.c: Auto merged storage/myisam/mi_test2.c: Auto merged storage/myisam/mi_test3.c: Auto merged storage/myisam/mi_unique.c: Auto merged storage/myisam/mi_update.c: Auto merged storage/myisam/mi_write.c: Auto merged storage/myisam/myisam_ftdump.c: Auto merged storage/myisam/myisamdef.h: Auto merged storage/myisam/myisamlog.c: Auto merged storage/myisam/myisampack.c: Auto merged storage/myisam/rt_index.c: Auto merged storage/myisam/rt_index.h: Auto merged storage/myisam/rt_key.h: Auto merged storage/myisam/rt_mbr.c: Auto merged storage/myisam/rt_mbr.h: Auto merged storage/myisam/rt_split.c: Auto merged storage/myisam/rt_test.c: Auto merged storage/myisam/sort.c: Auto merged storage/myisam/sp_defs.h: Auto merged storage/myisam/sp_test.c: Auto merged storage/myisammrg/Makefile.am: Auto merged storage/myisammrg/ha_myisammrg.cc: Auto merged storage/myisammrg/ha_myisammrg.h: Auto merged storage/myisammrg/myrg_close.c: Auto merged storage/myisammrg/myrg_create.c: Auto merged storage/myisammrg/myrg_def.h: Auto merged storage/myisammrg/myrg_delete.c: Auto merged storage/myisammrg/myrg_extra.c: Auto merged storage/myisammrg/myrg_info.c: Auto merged storage/myisammrg/myrg_locking.c: Auto merged storage/myisammrg/myrg_open.c: Auto merged storage/myisammrg/myrg_panic.c: Auto merged storage/myisammrg/myrg_queue.c: Auto merged storage/myisammrg/myrg_range.c: Auto merged storage/myisammrg/myrg_rfirst.c: Auto merged storage/myisammrg/myrg_rkey.c: Auto merged storage/myisammrg/myrg_rlast.c: Auto merged storage/myisammrg/myrg_rnext.c: Auto merged storage/myisammrg/myrg_rnext_same.c: Auto merged storage/myisammrg/myrg_rprev.c: Auto merged storage/myisammrg/myrg_rrnd.c: Auto merged storage/myisammrg/myrg_rsame.c: Auto merged storage/myisammrg/myrg_static.c: Auto merged storage/myisammrg/myrg_update.c: Auto merged storage/myisammrg/myrg_write.c: Auto merged storage/ndb/Makefile.am: Auto merged storage/ndb/config/common.mk.am: Auto merged storage/ndb/config/type_kernel.mk.am: Auto merged storage/ndb/config/type_mgmapiclient.mk.am: Auto merged storage/ndb/config/type_ndbapi.mk.am: Auto merged storage/ndb/config/type_ndbapiclient.mk.am: Auto merged storage/ndb/config/type_ndbapitest.mk.am: Auto merged storage/ndb/config/type_ndbapitools.mk.am: Auto merged storage/ndb/config/type_util.mk.am: Auto merged storage/ndb/docs/Makefile.am: Auto merged storage/ndb/include/Makefile.am: Auto merged storage/ndb/include/kernel/kernel_config_parameters.h: Auto merged storage/ndb/include/kernel/signaldata/CntrStart.hpp: Auto merged storage/ndb/include/kernel/signaldata/ReadConfig.hpp: Auto merged storage/ndb/include/kernel/signaldata/UpgradeStartup.hpp: Auto merged storage/ndb/include/logger/FileLogHandler.hpp: Auto merged storage/ndb/include/ndb_net.h: Auto merged storage/ndb/include/mgmapi/mgmapi_config_parameters.h: Auto merged storage/ndb/include/mgmapi/mgmapi_config_parameters_debug.h: Auto merged storage/ndb/include/util/ConfigValues.hpp: Auto merged storage/ndb/include/util/File.hpp: Auto merged storage/ndb/include/util/Vector.hpp: Auto merged storage/ndb/src/Makefile.am: Auto merged storage/ndb/src/common/Makefile.am: Auto merged storage/ndb/src/common/debugger/Makefile.am: Auto merged storage/ndb/src/common/debugger/signaldata/CntrStart.cpp: Auto merged storage/ndb/src/common/debugger/signaldata/Makefile.am: Auto merged storage/ndb/src/common/debugger/signaldata/ReadNodesConf.cpp: Auto merged storage/ndb/src/common/debugger/signaldata/print.awk: Auto merged storage/ndb/src/common/logger/FileLogHandler.cpp: Auto merged storage/ndb/src/common/logger/Makefile.am: Auto merged storage/ndb/src/common/mgmcommon/Makefile.am: Auto merged storage/ndb/src/common/transporter/Makefile.am: Auto merged storage/ndb/src/common/util/Bitmask.cpp: Auto merged storage/ndb/src/common/util/ConfigValues.cpp: Auto merged storage/ndb/src/common/util/File.cpp: Auto merged storage/ndb/src/common/util/Makefile.am: Auto merged storage/ndb/src/common/util/new.cpp: Auto merged storage/ndb/src/common/util/testConfigValues/testConfigValues.cpp: Auto merged storage/ndb/src/cw/Makefile.am: Auto merged storage/ndb/src/cw/cpcd/Makefile.am: Auto merged storage/ndb/src/kernel/blocks/Makefile.am: Auto merged storage/ndb/src/kernel/blocks/backup/Makefile.am: Auto merged storage/ndb/src/kernel/blocks/dbdict/Master_AddTable.sfl: Auto merged storage/ndb/src/kernel/blocks/dbdict/Slave_AddTable.sfl: Auto merged storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Auto merged storage/ndb/src/kernel/error/Makefile.am: Auto merged storage/ndb/src/kernel/vm/Makefile.am: Auto merged storage/ndb/src/mgmapi/Makefile.am: Auto merged storage/ndb/src/mgmapi/mgmapi_configuration.cpp: Auto merged storage/ndb/src/mgmclient/Makefile.am: Auto merged storage/ndb/src/mgmsrv/Makefile.am: Auto merged storage/ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged storage/ndb/src/ndbapi/Makefile.am: Auto merged storage/ndb/src/ndbapi/NdbTransaction.cpp: Auto merged storage/ndb/src/ndbapi/Ndbif.cpp: Auto merged storage/ndb/test/Makefile.am: Auto merged storage/ndb/test/ndbapi/Makefile.am: Auto merged storage/ndb/test/ndbapi/bank/Makefile.am: Auto merged storage/ndb/test/ndbapi/testBasic.cpp: Auto merged storage/ndb/test/ndbapi/testIndex.cpp: Auto merged storage/ndb/test/run-test/Makefile.am: Auto merged storage/ndb/test/run-test/daily-basic-tests.txt: Auto merged storage/ndb/test/src/Makefile.am: Auto merged storage/ndb/test/tools/Makefile.am: Auto merged storage/ndb/tools/Makefile.am: Auto merged strings/Makefile.am: Auto merged strings/ctype-extra.c: Auto merged tests/Makefile.am: Auto merged vio/Makefile.am: Auto merged BitKeeper/deleted/.del-colspec-fix.pl~6c78d3332330b19e: Auto merged BitKeeper/deleted/.del-docbook-fixup.pl~46cf3bdef147084e: Auto merged BitKeeper/deleted/.del-docbook-prefix.pl~876c7d33c68c224a: Auto merged BitKeeper/deleted/.del-docbook-split~be931c3922898d0: Auto merged BitKeeper/deleted/.del-make-docbook~ccac1eb717e92ac9: Auto merged BitKeeper/deleted/.del-make-makefile~39fd454b487126e8: Auto merged BitKeeper/deleted/.del-test-make-manual-de~33cad2886311b8a: Auto merged BitKeeper/deleted/.del-test-make-manual~5da458f958a424ec: Auto merged BitKeeper/deleted/.del-xwf~76b97805d9146b80: Auto merged server-tools/instance-manager/listener.h: SCCS merged server-tools/instance-manager/manager.h: SCCS merged server-tools/instance-manager/mysql_connection.h: SCCS merged server-tools/instance-manager/priv.h: SCCS merged storage/ndb/src/kernel/blocks/dblqh/Makefile.am: SCCS merged
669 lines
19 KiB
C++
669 lines
19 KiB
C++
/* Copyright (C) 2005-2006 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
#ifdef USE_PRAGMA_IMPLEMENTATION
|
|
#pragma implementation /* gcc class implementation */
|
|
#endif
|
|
|
|
#include "mysql_priv.h"
|
|
#include "sql_cursor.h"
|
|
#include "sql_select.h"
|
|
|
|
/****************************************************************************
|
|
Declarations.
|
|
****************************************************************************/
|
|
|
|
/*
|
|
Sensitive_cursor -- a sensitive non-materialized server side
|
|
cursor An instance of this class cursor has its own runtime
|
|
state -- list of used items and memory root for runtime memory,
|
|
open and locked tables, change list for the changes of the
|
|
parsed tree. This state is freed when the cursor is closed.
|
|
*/
|
|
|
|
class Sensitive_cursor: public Server_side_cursor
|
|
{
|
|
MEM_ROOT main_mem_root;
|
|
Query_arena *stmt_arena;
|
|
JOIN *join;
|
|
TABLE *open_tables;
|
|
MYSQL_LOCK *lock;
|
|
TABLE *derived_tables;
|
|
/* List of items created during execution */
|
|
query_id_t query_id;
|
|
struct Engine_info
|
|
{
|
|
handlerton *ht;
|
|
void *read_view;
|
|
};
|
|
Engine_info ht_info[MAX_HA];
|
|
Item_change_list change_list;
|
|
my_bool close_at_commit;
|
|
THR_LOCK_OWNER lock_id;
|
|
private:
|
|
/* bzero cursor state in THD */
|
|
void reset_thd(THD *thd);
|
|
public:
|
|
Sensitive_cursor(THD *thd, select_result *result_arg);
|
|
|
|
THR_LOCK_OWNER *get_lock_id() { return &lock_id; }
|
|
/* Save THD state into cursor */
|
|
void post_open(THD *thd);
|
|
|
|
virtual bool is_open() const { return join != 0; }
|
|
virtual int open(JOIN *join);
|
|
virtual void fetch(ulong num_rows);
|
|
virtual void close();
|
|
virtual ~Sensitive_cursor();
|
|
};
|
|
|
|
|
|
/*
|
|
Materialized_cursor -- an insensitive materialized server-side
|
|
cursor. The result set of this cursor is saved in a temporary
|
|
table at open. The cursor itself is simply an interface for the
|
|
handler of the temporary table.
|
|
*/
|
|
|
|
class Materialized_cursor: public Server_side_cursor
|
|
{
|
|
MEM_ROOT main_mem_root;
|
|
/* A fake unit to supply to select_send when fetching */
|
|
SELECT_LEX_UNIT fake_unit;
|
|
TABLE *table;
|
|
List<Item> item_list;
|
|
ulong fetch_limit;
|
|
ulong fetch_count;
|
|
public:
|
|
Materialized_cursor(select_result *result, TABLE *table);
|
|
|
|
virtual bool is_open() const { return table != 0; }
|
|
virtual int open(JOIN *join __attribute__((unused)));
|
|
virtual void fetch(ulong num_rows);
|
|
virtual void close();
|
|
virtual ~Materialized_cursor();
|
|
};
|
|
|
|
|
|
/*
|
|
Select_materialize -- a mediator between a cursor query and the
|
|
protocol. In case we were not able to open a non-materialzed
|
|
cursor, it creates an internal temporary HEAP table, and insert
|
|
all rows into it. When the table reaches max_heap_table_size,
|
|
it's converted to a MyISAM table. Later this table is used to
|
|
create a Materialized_cursor.
|
|
*/
|
|
|
|
class Select_materialize: public select_union
|
|
{
|
|
select_result *result; /* the result object of the caller (PS or SP) */
|
|
public:
|
|
Select_materialize(select_result *result_arg) :result(result_arg) {}
|
|
virtual bool send_fields(List<Item> &list, uint flags);
|
|
};
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/*
|
|
Attempt to open a materialized or non-materialized cursor.
|
|
|
|
SYNOPSIS
|
|
mysql_open_cursor()
|
|
thd thread handle
|
|
flags [in] create a materialized cursor or not
|
|
result [in] result class of the caller used as a destination
|
|
for the rows fetched from the cursor
|
|
pcursor [out] a pointer to store a pointer to cursor in
|
|
|
|
RETURN VALUE
|
|
0 the query has been successfully executed; in this
|
|
case pcursor may or may not contain
|
|
a pointer to an open cursor.
|
|
non-zero an error, 'pcursor' has been left intact.
|
|
*/
|
|
|
|
int mysql_open_cursor(THD *thd, uint flags, select_result *result,
|
|
Server_side_cursor **pcursor)
|
|
{
|
|
Sensitive_cursor *sensitive_cursor;
|
|
select_result *save_result;
|
|
Select_materialize *result_materialize;
|
|
LEX *lex= thd->lex;
|
|
int rc;
|
|
|
|
/*
|
|
The lifetime of the sensitive cursor is the same or less as the
|
|
lifetime of the runtime memory of the statement it's opened for.
|
|
*/
|
|
if (! (result_materialize= new (thd->mem_root) Select_materialize(result)))
|
|
return 1;
|
|
|
|
if (! (sensitive_cursor= new (thd->mem_root) Sensitive_cursor(thd, result)))
|
|
{
|
|
delete result;
|
|
return 1;
|
|
}
|
|
|
|
save_result= lex->result;
|
|
|
|
lex->result= result_materialize;
|
|
if (! (flags & (uint) ALWAYS_MATERIALIZED_CURSOR))
|
|
{
|
|
thd->lock_id= sensitive_cursor->get_lock_id();
|
|
thd->cursor= sensitive_cursor;
|
|
}
|
|
|
|
rc= mysql_execute_command(thd);
|
|
|
|
lex->result= save_result;
|
|
thd->lock_id= &thd->main_lock_id;
|
|
thd->cursor= 0;
|
|
|
|
/*
|
|
Possible options here:
|
|
- a sensitive cursor is open. In this case rc is 0 and
|
|
result_materialize->table is NULL, or
|
|
- a materialized cursor is open. In this case rc is 0 and
|
|
result_materialize->table is not NULL
|
|
- an error occured during materializaton.
|
|
result_materialize->table is not NULL, but rc != 0
|
|
- successful completion of mysql_execute_command without
|
|
a cursor: rc is 0, result_materialize->table is NULL,
|
|
sensitive_cursor is not open.
|
|
This is possible if some command writes directly to the
|
|
network, bypassing select_result mechanism. An example of
|
|
such command is SHOW VARIABLES or SHOW STATUS.
|
|
*/
|
|
if (rc)
|
|
goto err_open;
|
|
|
|
if (sensitive_cursor->is_open())
|
|
{
|
|
DBUG_ASSERT(!result_materialize->table);
|
|
/*
|
|
It's safer if we grab THD state after mysql_execute_command
|
|
is finished and not in Sensitive_cursor::open(), because
|
|
currently the call to Sensitive_cursor::open is buried deep
|
|
in JOIN::exec of the top level join.
|
|
*/
|
|
sensitive_cursor->post_open(thd);
|
|
*pcursor= sensitive_cursor;
|
|
goto end;
|
|
}
|
|
else if (result_materialize->table)
|
|
{
|
|
Materialized_cursor *materialized_cursor;
|
|
TABLE *table= result_materialize->table;
|
|
MEM_ROOT *mem_root= &table->mem_root;
|
|
|
|
if (!(materialized_cursor= new (mem_root)
|
|
Materialized_cursor(result, table)))
|
|
{
|
|
rc= 1;
|
|
goto err_open;
|
|
}
|
|
|
|
if ((rc= materialized_cursor->open(0)))
|
|
{
|
|
delete materialized_cursor;
|
|
goto err_open;
|
|
}
|
|
|
|
*pcursor= materialized_cursor;
|
|
thd->stmt_arena->cleanup_stmt();
|
|
goto end;
|
|
}
|
|
|
|
err_open:
|
|
DBUG_ASSERT(! (sensitive_cursor && sensitive_cursor->is_open()));
|
|
delete sensitive_cursor;
|
|
if (result_materialize->table)
|
|
free_tmp_table(thd, result_materialize->table);
|
|
end:
|
|
delete result_materialize;
|
|
return rc;
|
|
}
|
|
|
|
/****************************************************************************
|
|
Server_side_cursor
|
|
****************************************************************************/
|
|
|
|
Server_side_cursor::~Server_side_cursor()
|
|
{
|
|
}
|
|
|
|
|
|
void Server_side_cursor::operator delete(void *ptr, size_t size)
|
|
{
|
|
Server_side_cursor *cursor= (Server_side_cursor*) ptr;
|
|
MEM_ROOT own_root= *cursor->mem_root;
|
|
|
|
DBUG_ENTER("Server_side_cursor::operator delete");
|
|
TRASH(ptr, size);
|
|
/*
|
|
If this cursor has never been opened mem_root is empty. Otherwise
|
|
mem_root points to the memory the cursor object was allocated in.
|
|
In this case it's important to call free_root last, and free a copy
|
|
instead of *mem_root to avoid writing into freed memory.
|
|
*/
|
|
free_root(&own_root, MYF(0));
|
|
DBUG_VOID_RETURN;
|
|
}
|
|
|
|
/****************************************************************************
|
|
Sensitive_cursor
|
|
****************************************************************************/
|
|
|
|
Sensitive_cursor::Sensitive_cursor(THD *thd, select_result *result_arg)
|
|
:Server_side_cursor(&main_mem_root, result_arg),
|
|
stmt_arena(0),
|
|
join(0),
|
|
close_at_commit(FALSE)
|
|
{
|
|
/* We will overwrite it at open anyway. */
|
|
init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
|
|
thr_lock_owner_init(&lock_id, &thd->lock_info);
|
|
bzero((void*) ht_info, sizeof(ht_info));
|
|
}
|
|
|
|
|
|
void
|
|
Sensitive_cursor::post_open(THD *thd)
|
|
{
|
|
Engine_info *info;
|
|
/*
|
|
We need to save and reset thd->mem_root, otherwise it'll be
|
|
freed later in mysql_parse.
|
|
|
|
We can't just change thd->mem_root here as we want to keep the
|
|
things that are already allocated in thd->mem_root for
|
|
Sensitive_cursor::fetch()
|
|
*/
|
|
*mem_root= *thd->mem_root;
|
|
stmt_arena= thd->stmt_arena;
|
|
state= stmt_arena->state;
|
|
/* Allocate a new memory root for thd */
|
|
init_sql_alloc(thd->mem_root,
|
|
thd->variables.query_alloc_block_size,
|
|
thd->variables.query_prealloc_size);
|
|
|
|
/*
|
|
Save tables and zero THD pointers to prevent table close in
|
|
close_thread_tables.
|
|
*/
|
|
derived_tables= thd->derived_tables;
|
|
open_tables= thd->open_tables;
|
|
lock= thd->lock;
|
|
query_id= thd->query_id;
|
|
free_list= thd->free_list;
|
|
change_list= thd->change_list;
|
|
reset_thd(thd);
|
|
/* Now we have an active cursor and can cause a deadlock */
|
|
thd->lock_info.n_cursors++;
|
|
|
|
close_at_commit= FALSE; /* reset in case we're reusing the cursor */
|
|
info= &ht_info[0];
|
|
for (handlerton **pht= thd->transaction.stmt.ht; *pht; pht++)
|
|
{
|
|
handlerton *ht= *pht;
|
|
close_at_commit|= test(ht->flags & HTON_CLOSE_CURSORS_AT_COMMIT);
|
|
if (ht->create_cursor_read_view)
|
|
{
|
|
info->ht= ht;
|
|
info->read_view= (ht->create_cursor_read_view)(ht, thd);
|
|
++info;
|
|
}
|
|
}
|
|
/*
|
|
XXX: thd->locked_tables is not changed.
|
|
What problems can we have with it if cursor is open?
|
|
TODO: must be fixed because of the prelocked mode.
|
|
*/
|
|
}
|
|
|
|
|
|
void
|
|
Sensitive_cursor::reset_thd(THD *thd)
|
|
{
|
|
thd->derived_tables= 0;
|
|
thd->open_tables= 0;
|
|
thd->lock= 0;
|
|
thd->free_list= 0;
|
|
thd->change_list.empty();
|
|
}
|
|
|
|
|
|
int
|
|
Sensitive_cursor::open(JOIN *join_arg)
|
|
{
|
|
join= join_arg;
|
|
THD *thd= join->thd;
|
|
/* First non-constant table */
|
|
JOIN_TAB *join_tab= join->join_tab + join->const_tables;
|
|
DBUG_ENTER("Sensitive_cursor::open");
|
|
|
|
join->change_result(result);
|
|
/*
|
|
Send fields description to the client; server_status is sent
|
|
in 'EOF' packet, which follows send_fields().
|
|
We don't simply use SEND_EOF flag of send_fields because we also
|
|
want to flush the network buffer, which is done only in a standalone
|
|
send_eof().
|
|
*/
|
|
result->send_fields(*join->fields, Protocol::SEND_NUM_ROWS);
|
|
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
|
|
result->send_eof();
|
|
thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
|
|
|
|
/* Prepare JOIN for reading rows. */
|
|
join->tmp_table= 0;
|
|
join->join_tab[join->tables-1].next_select= setup_end_select_func(join);
|
|
join->send_records= 0;
|
|
join->fetch_limit= join->unit->offset_limit_cnt;
|
|
|
|
/* Disable JOIN CACHE as it is not working with cursors yet */
|
|
for (JOIN_TAB *tab= join_tab;
|
|
tab != join->join_tab + join->tables - 1;
|
|
tab++)
|
|
{
|
|
if (tab->next_select == sub_select_cache)
|
|
tab->next_select= sub_select;
|
|
}
|
|
|
|
DBUG_ASSERT(join_tab->table->reginfo.not_exists_optimize == 0);
|
|
DBUG_ASSERT(join_tab->not_used_in_distinct == 0);
|
|
/*
|
|
null_row is set only if row not found and it's outer join: should never
|
|
happen for the first table in join_tab list
|
|
*/
|
|
DBUG_ASSERT(join_tab->table->null_row == 0);
|
|
DBUG_RETURN(0);
|
|
}
|
|
|
|
|
|
/*
|
|
SYNOPSIS
|
|
Sensitive_cursor::fetch()
|
|
num_rows fetch up to this number of rows (maybe less)
|
|
|
|
DESCRIPTION
|
|
Fetch next num_rows rows from the cursor and send them to the client
|
|
|
|
Precondition:
|
|
Sensitive_cursor is open
|
|
|
|
RETURN VALUES:
|
|
none, this function will send OK to the clinet or set an error
|
|
message in THD
|
|
*/
|
|
|
|
void
|
|
Sensitive_cursor::fetch(ulong num_rows)
|
|
{
|
|
THD *thd= join->thd;
|
|
JOIN_TAB *join_tab= join->join_tab + join->const_tables;
|
|
enum_nested_loop_state error= NESTED_LOOP_OK;
|
|
Query_arena backup_arena;
|
|
Engine_info *info;
|
|
DBUG_ENTER("Sensitive_cursor::fetch");
|
|
DBUG_PRINT("enter",("rows: %lu", num_rows));
|
|
|
|
DBUG_ASSERT(thd->derived_tables == 0 && thd->open_tables == 0 &&
|
|
thd->lock == 0);
|
|
|
|
thd->derived_tables= derived_tables;
|
|
thd->open_tables= open_tables;
|
|
thd->lock= lock;
|
|
thd->query_id= query_id;
|
|
thd->change_list= change_list;
|
|
/* save references to memory allocated during fetch */
|
|
thd->set_n_backup_active_arena(this, &backup_arena);
|
|
|
|
for (info= ht_info; info->read_view ; info++)
|
|
(info->ht->set_cursor_read_view)(info->ht, thd, info->read_view);
|
|
|
|
join->fetch_limit+= num_rows;
|
|
|
|
error= sub_select(join, join_tab, 0);
|
|
if (error == NESTED_LOOP_OK || error == NESTED_LOOP_NO_MORE_ROWS)
|
|
error= sub_select(join,join_tab,1);
|
|
if (error == NESTED_LOOP_QUERY_LIMIT)
|
|
error= NESTED_LOOP_OK; /* select_limit used */
|
|
if (error == NESTED_LOOP_CURSOR_LIMIT)
|
|
join->resume_nested_loop= TRUE;
|
|
|
|
ha_release_temporary_latches(thd);
|
|
|
|
/* Grab free_list here to correctly free it in close */
|
|
thd->restore_active_arena(this, &backup_arena);
|
|
|
|
change_list= thd->change_list;
|
|
reset_thd(thd);
|
|
|
|
for (info= ht_info; info->read_view; info++)
|
|
(info->ht->set_cursor_read_view)(info->ht, thd, 0);
|
|
|
|
if (error == NESTED_LOOP_CURSOR_LIMIT)
|
|
{
|
|
/* Fetch limit worked, possibly more rows are there */
|
|
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
|
|
result->send_eof();
|
|
thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
|
|
}
|
|
else
|
|
{
|
|
close();
|
|
if (error == NESTED_LOOP_OK)
|
|
{
|
|
thd->server_status|= SERVER_STATUS_LAST_ROW_SENT;
|
|
result->send_eof();
|
|
thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
|
|
}
|
|
else if (error != NESTED_LOOP_KILLED)
|
|
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
|
|
}
|
|
DBUG_VOID_RETURN;
|
|
}
|
|
|
|
|
|
void
|
|
Sensitive_cursor::close()
|
|
{
|
|
THD *thd= join->thd;
|
|
DBUG_ENTER("Sensitive_cursor::close");
|
|
|
|
for (Engine_info *info= ht_info; info->read_view; info++)
|
|
{
|
|
(info->ht->close_cursor_read_view)(info->ht, thd, info->read_view);
|
|
info->read_view= 0;
|
|
info->ht= 0;
|
|
}
|
|
|
|
thd->change_list= change_list;
|
|
{
|
|
/*
|
|
XXX: Another hack: we need to set THD state as if in a fetch to be
|
|
able to call stmt close.
|
|
*/
|
|
DBUG_ASSERT(lock || open_tables || derived_tables);
|
|
|
|
TABLE *tmp_derived_tables= thd->derived_tables;
|
|
MYSQL_LOCK *tmp_lock= thd->lock;
|
|
|
|
thd->open_tables= open_tables;
|
|
thd->derived_tables= derived_tables;
|
|
thd->lock= lock;
|
|
|
|
/* Is expected to at least close tables and empty thd->change_list */
|
|
stmt_arena->cleanup_stmt();
|
|
|
|
thd->open_tables= tmp_derived_tables;
|
|
thd->derived_tables= tmp_derived_tables;
|
|
thd->lock= tmp_lock;
|
|
}
|
|
thd->lock_info.n_cursors--; /* Decrease the number of active cursors */
|
|
join= 0;
|
|
stmt_arena= 0;
|
|
free_items();
|
|
change_list.empty();
|
|
DBUG_VOID_RETURN;
|
|
}
|
|
|
|
|
|
Sensitive_cursor::~Sensitive_cursor()
|
|
{
|
|
if (is_open())
|
|
close();
|
|
}
|
|
|
|
/***************************************************************************
|
|
Materialized_cursor
|
|
****************************************************************************/
|
|
|
|
Materialized_cursor::Materialized_cursor(select_result *result_arg,
|
|
TABLE *table_arg)
|
|
:Server_side_cursor(&table_arg->mem_root, result_arg),
|
|
table(table_arg),
|
|
fetch_limit(0),
|
|
fetch_count(0)
|
|
{
|
|
fake_unit.init_query();
|
|
fake_unit.thd= table->in_use;
|
|
}
|
|
|
|
|
|
int Materialized_cursor::open(JOIN *join __attribute__((unused)))
|
|
{
|
|
THD *thd= fake_unit.thd;
|
|
int rc;
|
|
Query_arena backup_arena;
|
|
|
|
thd->set_n_backup_active_arena(this, &backup_arena);
|
|
/* Create a list of fields and start sequential scan */
|
|
rc= (table->fill_item_list(&item_list) ||
|
|
result->prepare(item_list, &fake_unit) ||
|
|
table->file->ha_rnd_init(TRUE));
|
|
thd->restore_active_arena(this, &backup_arena);
|
|
if (rc == 0)
|
|
{
|
|
/*
|
|
Now send the result set metadata to the client. We need to
|
|
do it here, as in Select_materialize::send_fields the items
|
|
for column types are not yet created (send_fields requires
|
|
a list of items). The new types may differ from the original
|
|
ones sent at prepare if some of them were altered by MySQL
|
|
HEAP tables mechanism -- used when create_tmp_field_from_item
|
|
may alter the original column type.
|
|
|
|
We can't simply supply SEND_EOF flag to send_fields, because
|
|
send_fields doesn't flush the network buffer.
|
|
*/
|
|
rc= result->send_fields(item_list, Protocol::SEND_NUM_ROWS);
|
|
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
|
|
result->send_eof();
|
|
thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
|
|
}
|
|
return rc;
|
|
}
|
|
|
|
|
|
/*
|
|
Fetch up to the given number of rows from a materialized cursor.
|
|
|
|
DESCRIPTION
|
|
Precondition: the cursor is open.
|
|
|
|
If the cursor points after the last row, the fetch will automatically
|
|
close the cursor and not send any data (except the 'EOF' packet
|
|
with SERVER_STATUS_LAST_ROW_SENT). This is an extra round trip
|
|
and probably should be improved to return
|
|
SERVER_STATUS_LAST_ROW_SENT along with the last row.
|
|
|
|
RETURN VALUE
|
|
none, in case of success the row is sent to the client, otherwise
|
|
an error message is set in THD
|
|
*/
|
|
|
|
void Materialized_cursor::fetch(ulong num_rows)
|
|
{
|
|
THD *thd= table->in_use;
|
|
|
|
int res= 0;
|
|
result->begin_dataset();
|
|
for (fetch_limit+= num_rows; fetch_count < fetch_limit; fetch_count++)
|
|
{
|
|
if ((res= table->file->rnd_next(table->record[0])))
|
|
break;
|
|
/* Send data only if the read was successful. */
|
|
result->send_data(item_list);
|
|
}
|
|
|
|
switch (res) {
|
|
case 0:
|
|
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
|
|
result->send_eof();
|
|
thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
|
|
break;
|
|
case HA_ERR_END_OF_FILE:
|
|
thd->server_status|= SERVER_STATUS_LAST_ROW_SENT;
|
|
result->send_eof();
|
|
thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT;
|
|
close();
|
|
break;
|
|
default:
|
|
table->file->print_error(res, MYF(0));
|
|
close();
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
void Materialized_cursor::close()
|
|
{
|
|
/* Free item_list items */
|
|
free_items();
|
|
(void) table->file->ha_rnd_end();
|
|
/*
|
|
We need to grab table->mem_root to prevent free_tmp_table from freeing:
|
|
the cursor object was allocated in this memory.
|
|
*/
|
|
main_mem_root= table->mem_root;
|
|
mem_root= &main_mem_root;
|
|
clear_alloc_root(&table->mem_root);
|
|
free_tmp_table(table->in_use, table);
|
|
table= 0;
|
|
}
|
|
|
|
|
|
Materialized_cursor::~Materialized_cursor()
|
|
{
|
|
if (is_open())
|
|
close();
|
|
}
|
|
|
|
|
|
/***************************************************************************
|
|
Select_materialize
|
|
****************************************************************************/
|
|
|
|
bool Select_materialize::send_fields(List<Item> &list, uint flags)
|
|
{
|
|
DBUG_ASSERT(table == 0);
|
|
if (create_result_table(unit->thd, unit->get_unit_column_types(),
|
|
FALSE, thd->options | TMP_TABLE_ALL_COLUMNS, ""))
|
|
return TRUE;
|
|
return FALSE;
|
|
}
|
|
|