mariadb/sql/ha_ndbcluster.cc

8523 lines
242 KiB
C++
Raw Normal View History

Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
/* Copyright (C) 2000-2003 MySQL AB
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
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; either version 2 of the License, or
(at your option) any later version.
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
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
/*
This file defines the NDB Cluster handler: the interface between MySQL and
NDB Cluster
*/
Add ifdefs to control when "#pragma implementation" should be used Added some more ifdefs for "#pragma interface" client/sql_string.cc: USE_PRAGMA_IMPLEMENTATION client/sql_string.h: USE_PRAGMA_INTERFACE include/my_global.h: Use pragma implementation for gcc pre version 3 mysys/raid.cc: USE_PRAGMA_IMPLEMENTATION sql/field.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_berkeley.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_blackhole.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_heap.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_innodb.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_isam.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_isammrg.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_myisam.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_myisammrg.cc: USE_PRAGMA_IMPLEMENTATION sql/ha_ndbcluster.cc: USE_PRAGMA_IMPLEMENTATION sql/handler.cc: USE_PRAGMA_IMPLEMENTATION sql/hash_filo.cc: USE_PRAGMA_IMPLEMENTATION sql/item.cc: USE_PRAGMA_IMPLEMENTATION sql/item_cmpfunc.cc: USE_PRAGMA_IMPLEMENTATION sql/item_func.cc: USE_PRAGMA_IMPLEMENTATION sql/item_geofunc.cc: USE_PRAGMA_IMPLEMENTATION sql/item_strfunc.cc: USE_PRAGMA_IMPLEMENTATION sql/item_subselect.cc: USE_PRAGMA_IMPLEMENTATION sql/item_sum.cc: USE_PRAGMA_IMPLEMENTATION sql/item_timefunc.cc: USE_PRAGMA_IMPLEMENTATION sql/item_uniq.cc: USE_PRAGMA_IMPLEMENTATION sql/item_uniq.h: USE_PRAGMA_INTERFACE sql/log_event.cc: USE_PRAGMA_IMPLEMENTATION sql/log_event.h: USE_PRAGMA_INTERFACE sql/opt_range.cc: USE_PRAGMA_IMPLEMENTATION sql/procedure.cc: USE_PRAGMA_IMPLEMENTATION sql/protocol.cc: USE_PRAGMA_IMPLEMENTATION sql/protocol_cursor.cc: USE_PRAGMA_IMPLEMENTATION sql/set_var.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_analyse.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_analyse.h: USE_PRAGMA_INTERFACE sql/sql_class.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_crypt.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_crypt.h: USE_PRAGMA_IMPLEMENTATION sql/sql_list.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_map.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_map.h: USE_PRAGMA_INTERFACE sql/sql_olap.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_select.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_string.cc: USE_PRAGMA_IMPLEMENTATION sql/sql_udf.cc: USE_PRAGMA_IMPLEMENTATION sql/tztime.cc: USE_PRAGMA_IMPLEMENTATION
2005-05-26 12:09:14 +02:00
#ifdef USE_PRAGMA_IMPLEMENTATION
Move USE_PRAGMA_IMPLEMENTATION to proper place Ensure that 'null_value' is not accessed before val() is called in FIELD() functions Fixed initialization of key maps. This fixes some problems with keys when you have more than 64 keys Fixed that ROLLUP don't always create a temporary table. This fix ensures that func_gconcat.test results are now predictable mysql-test/r/func_gconcat.result: Move innodb specific test to innodb.test Changed table name r2 -> t2 More test to see how ROLLUP was optimized mysql-test/r/innodb.result: Moved test here form func_gconcat mysql-test/r/olap.result: New test results after optimization mysql-test/t/func_gconcat.test: Move innodb specific test to innodb.test Changed table name r2 -> t2 More test to see how ROLLUP was optimized mysql-test/t/innodb.test: Moved test here form func_gconcat sql/field.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_berkeley.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_blackhole.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_heap.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_innodb.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_isam.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_isammrg.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_myisam.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_myisammrg.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_ndbcluster.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/handler.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/hash_filo.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_cmpfunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_func.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place Ensure that 'null_value' is not accessed before val() is called sql/item_geofunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_strfunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_subselect.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_sum.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_timefunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_uniq.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/log_event.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/mysql_priv.h: Change key_map_full to not be const as we are giving it a proper value on startup sql/mysqld.cc: Move key_map variables here and initialize key_map_full properly sql/opt_range.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/opt_range.h: Fix that test_quick_select() works with any ammount of keys sql/procedure.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/protocol.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/protocol_cursor.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/set_var.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_analyse.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_class.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_crypt.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_insert.cc: Fixed that max_rows is ulong sql/sql_list.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_map.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_olap.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_select.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place Fixed that ROLLUP don't have to always create a temporary table Added new argument to remove_const() to make above possible Fixed some errors that creapt up when we don't always do a temporary table for ROLLUP sql/sql_string.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_table.cc: Simple optimizations Fixed wrong checking of build_table_path() in undef-ed code sql/sql_udf.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_yacc.yy: removed extra {}
2005-06-03 22:46:03 +02:00
#pragma implementation // gcc: Class implementation
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#endif
#include "mysql_priv.h"
#include <my_dir.h>
#include "ha_ndbcluster.h"
#include <ndbapi/NdbApi.hpp>
#include <ndbapi/NdbScanFilter.hpp>
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
#include <../util/Bitmask.hpp>
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
#include <ndbapi/NdbIndexStat.hpp>
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
added config parameter Group on connection moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection moved all private things to impl class added opts for shared memory and node selection changed opts handling somewhat; introduced enum for options and common handling of option variables added checks for transporter support automatic addition of shared mem transporters moved wait_until_ready code to cluster connection added control of usage of new node selection method ndb/include/mgmapi/mgmapi_config_parameters.h: added config parameter Group on connection ndb/include/ndbapi/Ndb.hpp: moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection ndb/include/ndbapi/ndb_cluster_connection.hpp: moved all private things to impl class ndb/include/util/ndb_opts.h: added opts for shared memory and node selection ndb/src/kernel/vm/Configuration.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmclient/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmsrv/ConfigInfo.cpp: added checks for transporter support automatic addition of shared mem transporters ndb/src/mgmsrv/MgmtSrvr.cpp: in alloc node id first choose connection with specified hostname ndb/src/mgmsrv/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/ndbapi/DictCache.hpp: added include file ndb/src/ndbapi/Ndb.cpp: enabled using new node selection method moved wait_until_ready code to cluster connection moved node selection (hint) to cluster connection removed start transaction dgroup ndb/src/ndbapi/NdbDictionaryImpl.hpp: removed and added inclusde files ndb/src/ndbapi/NdbImpl.hpp: moved things from Ndb into Impl class moved waiter things to new file NdbWaiter.hpp ndb/src/ndbapi/NdbScanOperation.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbif.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbinit.cpp: moved some Ndb things into impl class ndb/src/ndbapi/TransporterFacade.hpp: changed friend declaration ndb/src/ndbapi/ndb_cluster_connection.cpp: moved node selection things to cluster connection moved things from cluster connection to cluster connection impl class ndb/test/ndbapi/testNdbApi.cpp: removed start transaction dgroup ndb/tools/delete_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/desc.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_index.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_tab.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/listTables.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/restore/restore_main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_count.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/waiter.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables sql/ha_ndbcluster.cc: added control of usage of new node selection method sql/mysqld.cc: added control of usage of new node selection method
2004-12-20 12:36:14 +01:00
// options from from mysqld.cc
extern my_bool opt_ndb_optimized_node_selection;
extern const char *opt_ndbcluster_connectstring;
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
const char *ndb_distribution_names[]= {"KEYHASH", "LINHASH", NullS};
TYPELIB ndb_distribution_typelib= { array_elements(ndb_distribution_names)-1,
"", ndb_distribution_names, NULL };
const char *opt_ndb_distribution= ndb_distribution_names[ND_KEYHASH];
enum ndb_distribution opt_ndb_distribution_id= ND_KEYHASH;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Default value for parallelism
static const int parallelism= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Default value for max number of transactions
// createable against NDB from this handler
static const int max_transactions= 3; // should really be 2 but there is a transaction to much allocated when loch table is used
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
static const char *ha_ndb_ext=".ndb";
static const char share_prefix[]= "./";
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
static int ndbcluster_close_connection(THD *thd);
static int ndbcluster_commit(THD *thd, bool all);
static int ndbcluster_rollback(THD *thd, bool all);
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
static handler* ndbcluster_create_handler(TABLE_SHARE *table);
handlerton ndbcluster_hton = {
Finalize storage engine plugins Give BerkeleyDB savepoints Remove "enum db_type" from most of the code storage/example/ha_example.h: Rename: sql/examples/ha_example.h -> storage/example/ha_example.h storage/csv/ha_tina.h: Rename: sql/examples/ha_tina.h -> storage/csv/ha_tina.h config/ac-macros/storage.m4: if hton name is "no", then we don't install it as a builtin configure.in: pluggable changes include/plugin.h: version field mysql-test/r/bdb.result: savepoint results copied from innodb test mysql-test/r/information_schema.result: PLUGINS information schema mysql-test/r/information_schema_db.result: PLUGINS information schema mysql-test/t/bdb.test: savepoint test copied from innodb test sql/Makefile.am: tina and example are not here anymore sql/authors.h: minor tweek sql/ha_archive.cc: remove unwanted handlerton entries sql/ha_berkeley.cc: remove unwanted handlerton entries support for savepoints changes to show logs sql/ha_blackhole.cc: remove unwanted handlerton entries sql/ha_federated.cc: remove unwanted handlerton entries sql/ha_heap.cc: remove unwanted handlerton entries sql/ha_innodb.cc: remove unwanted handlerton entries changes for show status sql/ha_myisam.cc: remove unwanted handlerton entries sql/ha_myisammrg.cc: remove unwanted handlerton entries sql/ha_ndbcluster.cc: remove unwanted handlerton entries changes to stat_print sql/ha_partition.cc: remove unwanted handlerton entries bye bye enum db_type sql/ha_partition.h: bye bye enum db_type sql/handler.cc: remove unwanted handlerton entries bye bye enum db_type sql/handler.h: remove unwanted handlerton entries bye bye enum db_type changes to stat_print_fn sql/item_sum.cc: bye bye enum db_type sql/log.cc: remove unwanted handlerton entries sql/mysql_priv.h: bye bye enum db_type sql/mysqld.cc: bye bye enum db_type reorder plugin initialization sql/set_var.cc: bye bye enum db_type sql/set_var.h: bye bye enum db_type sql/sql_base.cc: bye bye enum db_type sql/sql_cache.cc: bye bye enum db_type sql/sql_class.h: bye bye enum db_type sql/sql_delete.cc: bye bye enum db_type sql/sql_insert.cc: bye bye enum db_type sql/sql_lex.h: show plugin sql/sql_parse.cc: bye bye enum db_type sql/sql_partition.cc: bye bye enum db_type sql/sql_plugin.cc: loadable storage engines sql/sql_plugin.h: loadable storage engines sql/sql_rename.cc: bye bye enum db_type sql/sql_select.cc: bye bye enum db_type sql/sql_show.cc: SHOW PLUGIN PLUGINS information schema changes to show engines sql/sql_table.cc: bye bye enum db_type sql/sql_view.cc: bye bye enum db_type sql/sql_view.h: bye bye enum db_type sql/sql_yacc.yy: bye bye enum db_type sql/table.cc: bye bye enum db_type sql/table.h: bye bye enum db_type sql/unireg.cc: bye bye enum db_type storage/csv/ha_tina.cc: make tina into a loadable plugin storage/example/ha_example.cc: make into a plugin storage/csv/Makefile.am: New BitKeeper file ``storage/csv/Makefile.am'' storage/example/Makefile.am: New BitKeeper file ``storage/example/Makefile.am''
2005-12-21 19:18:40 +01:00
MYSQL_HANDLERTON_INTERFACE_VERSION,
"ndbcluster",
Next big patch for loadable storage engines! Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types
2005-10-03 04:44:28 +02:00
SHOW_OPTION_YES,
"Clustered, fault-tolerant, memory-based tables",
DB_TYPE_NDBCLUSTER,
ndbcluster_init,
0, /* slot */
0, /* savepoint size */
ndbcluster_close_connection,
NULL, /* savepoint_set */
NULL, /* savepoint_rollback */
NULL, /* savepoint_release */
ndbcluster_commit,
ndbcluster_rollback,
NULL, /* prepare */
NULL, /* recover */
NULL, /* commit_by_xid */
A fix and a test case for Bug#10760 and complementary cleanups. The idea of the patch is that every cursor gets its own lock id for table level locking. Thus cursors are protected from updates performed within the same connection. Additionally a list of transient (must be closed at commit) cursors is maintained and all transient cursors are closed when necessary. Lastly, this patch adds support for deadlock timeouts to TLL locking when using cursors. + post-review fixes. include/thr_lock.h: - add a notion of lock owner to table level locking. When using cursors, lock owner can not be identified by a thread id any more, as we must protect cursors from updates issued within the same connection (thread). So, each cursor has its own lock identifier to use with table level locking. - extend return values of thr_lock and thr_multi_lock with THR_LOCK_TIMEOUT and THR_LOCK_DEADLOCK, since these conditions are now possible (see comments to thr_lock.c) mysys/thr_lock.c: Better support for cursors: - use THR_LOCK_OWNER * as lock identifier, not pthread_t. - check and return an error for a trivial deadlock case, when an update statement is issued to a table locked by a cursor which has been previously opened in the same connection. - add support for locking timeouts: with use of cursors, trivial deadlocks can occur. For now the only remedy is the lock wait timeout, which is initialized from a new global variable 'table_lock_wait_timeout' Example of a deadlock (assuming the storage engine does not downgrade locks): con1: open cursor for select * from t1; con2: open cursor for select * from t2; con1: update t2 set id=id*2; -- blocked con2: update t1 set id=id*2; -- deadlock Lock timeouts are active only if a connection is using cursors. - the check in the wait_for_lock loop has been changed from data->cond != cond to data->cond != 0. data->cond is zeroed in every place it's changed. - added comments sql/examples/ha_archive.cc: - extend the handlerton with the info about cursor behaviour at commit. sql/examples/ha_archive.h: - ctor moved to .cc to make use of archive handlerton sql/examples/ha_example.cc: - add handlerton instance, init handler::ht with it sql/examples/ha_example.h: - ctor moved to .cc to make use of ha_example handlerton sql/examples/ha_tina.cc: - add handlerton instance, init handler::ht with it sql/examples/ha_tina.h: - ctor moved to .cc to make use of CSV handlerton sql/ha_berkeley.cc: - init handlerton::flags and handler::ht sql/ha_berkeley.h: - ctor moved to .cc to make use of BerkeleyDB handlerton sql/ha_blackhole.cc: - add handlerton instance, init handler::ht with it sql/ha_blackhole.h: - ctor moved to .cc to make use of blackhole handlerton sql/ha_federated.cc: - add handlerton instance, init handler::ht with it sql/ha_federated.h: - ctor moved to .cc to make use of federated handlerton sql/ha_heap.cc: - add handlerton instance, init handler::ht with it sql/ha_heap.h: - ctor moved to .cc to make use of ha_heap handlerton sql/ha_innodb.cc: - init handlerton::flags and handler::ht of innobase storage engine sql/ha_innodb.h: - ctor moved to .cc to make use of archive handlerton sql/ha_myisam.cc: - add handlerton instance, init handler::ht with it sql/ha_myisam.h: - ctor moved to .cc to make use of MyISAM handlerton sql/ha_myisammrg.cc: - init handler::ht in the ctor sql/ha_myisammrg.h: - ctor moved to .cc to make use of MyISAM MERGE handlerton sql/ha_ndbcluster.cc: - init handlerton::flags and handler::ht sql/handler.cc: - drop support for ISAM storage engine, which was removed from 5.0 - close all "transient" cursors at COMMIT/ROLLBACK. A "transient" SQL level cursor is a cursor that uses tables that have a transaction- specific state. sql/handler.h: - extend struct handlerton with flags, add handlerton *ht to every handler instance. sql/lock.cc: - extend mysql_lock_tables to send error to the client if thr_multi_lock returns a timeout or a deadlock error. sql/mysqld.cc: - add server option --table_lock_wait_timeout (in seconds) sql/set_var.cc: - add new global variable 'table_lock_wait_timeout' to specify a wait timeout for table-level locks of MySQL (in seconds). The default timeout is 50 seconds. The timeout is active only if the connection has open cursors. sql/sql_class.cc: - implement Statement_map::close_transient_cursors - safety suggests that we need an assert ensuring llock_info->n_cursors is functioning properly, adjust destruction of the Statement_map to allow such assert in THD::~THD sql/sql_class.h: - add support for Cursors registry to Statement map. sql/sql_prepare.cc: - maintain a list of cursors that must be closed at commit/rollback. sql/sql_select.cc: - extend class Cursor to support specific at-COMMIT/ROLLBACK behavior. If a cursor uses tables of a storage engine that invalidates all open tables at COMMIT/ROLLBACK, it must be closed before COMMIT/ROLLBACK is executed. sql/sql_select.h: - add an own lock_id and commit/rollback status flag to class Cursor tests/mysql_client_test.c: A test case for Bug#10760 and complementary issues: test a simple deadlock case too. mysql-test/var: New BitKeeper file ``mysql-test/var''
2005-07-19 20:21:12 +02:00
NULL, /* rollback_by_xid */
Implement MySQL framework to support consistent read views in cursors. This should fix Bug#11813 when InnoDB part is in (tested with a draft patch). The idea of the patch is that if a storage engine supports consistent read views, we open one when open a cursor, set is as the active view when fetch from the cursor, and close together with cursor close. sql/examples/ha_archive.cc: - extend handlerton with cursors methods; fix coding style sql/examples/ha_example.cc: - extend handlerton with cursors methods; fix coding style sql/examples/ha_tina.cc: - extend handlerton with cursors methods; fix coding style sql/ha_berkeley.cc: - extend handlerton with cursors methods sql/ha_blackhole.cc: - extend handlerton with cursors methods; fix coding style sql/ha_federated.cc: - extend handlerton with cursors methods; fix coding style sql/ha_heap.cc: - extend handlerton with cursors methods; fix coding style sql/ha_innodb.cc: - extend handlerton with cursors methods sql/ha_myisam.cc: - extend handlerton with cursors methods; fix coding style sql/ha_myisammrg.cc: - extend handlerton with cursors methods; fix coding style sql/ha_ndbcluster.cc: - extend handlerton with cursors methods sql/handler.h: - extend handlerton with cursors methods sql/sql_select.cc: - create a consistent read view when we open a cursor, set it for a fetch, and free when we closing the cursor. sql/sql_select.h: - add Cursor::ht_info to remember read views used in a cursor. tests/mysql_client_test.c: Disable an assert that will be no longer valid when consistent read views in InnoDB are used.
2005-07-20 18:02:36 +02:00
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
ndbcluster_create_handler, /* Create a new handler */
ndbcluster_drop_database, /* Drop a database */
ndbcluster_end, /* Panic call */
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
ndbcluster_show_status, /* Show status */
A fix and a test case for Bug#10760 and complementary cleanups. The idea of the patch is that every cursor gets its own lock id for table level locking. Thus cursors are protected from updates performed within the same connection. Additionally a list of transient (must be closed at commit) cursors is maintained and all transient cursors are closed when necessary. Lastly, this patch adds support for deadlock timeouts to TLL locking when using cursors. + post-review fixes. include/thr_lock.h: - add a notion of lock owner to table level locking. When using cursors, lock owner can not be identified by a thread id any more, as we must protect cursors from updates issued within the same connection (thread). So, each cursor has its own lock identifier to use with table level locking. - extend return values of thr_lock and thr_multi_lock with THR_LOCK_TIMEOUT and THR_LOCK_DEADLOCK, since these conditions are now possible (see comments to thr_lock.c) mysys/thr_lock.c: Better support for cursors: - use THR_LOCK_OWNER * as lock identifier, not pthread_t. - check and return an error for a trivial deadlock case, when an update statement is issued to a table locked by a cursor which has been previously opened in the same connection. - add support for locking timeouts: with use of cursors, trivial deadlocks can occur. For now the only remedy is the lock wait timeout, which is initialized from a new global variable 'table_lock_wait_timeout' Example of a deadlock (assuming the storage engine does not downgrade locks): con1: open cursor for select * from t1; con2: open cursor for select * from t2; con1: update t2 set id=id*2; -- blocked con2: update t1 set id=id*2; -- deadlock Lock timeouts are active only if a connection is using cursors. - the check in the wait_for_lock loop has been changed from data->cond != cond to data->cond != 0. data->cond is zeroed in every place it's changed. - added comments sql/examples/ha_archive.cc: - extend the handlerton with the info about cursor behaviour at commit. sql/examples/ha_archive.h: - ctor moved to .cc to make use of archive handlerton sql/examples/ha_example.cc: - add handlerton instance, init handler::ht with it sql/examples/ha_example.h: - ctor moved to .cc to make use of ha_example handlerton sql/examples/ha_tina.cc: - add handlerton instance, init handler::ht with it sql/examples/ha_tina.h: - ctor moved to .cc to make use of CSV handlerton sql/ha_berkeley.cc: - init handlerton::flags and handler::ht sql/ha_berkeley.h: - ctor moved to .cc to make use of BerkeleyDB handlerton sql/ha_blackhole.cc: - add handlerton instance, init handler::ht with it sql/ha_blackhole.h: - ctor moved to .cc to make use of blackhole handlerton sql/ha_federated.cc: - add handlerton instance, init handler::ht with it sql/ha_federated.h: - ctor moved to .cc to make use of federated handlerton sql/ha_heap.cc: - add handlerton instance, init handler::ht with it sql/ha_heap.h: - ctor moved to .cc to make use of ha_heap handlerton sql/ha_innodb.cc: - init handlerton::flags and handler::ht of innobase storage engine sql/ha_innodb.h: - ctor moved to .cc to make use of archive handlerton sql/ha_myisam.cc: - add handlerton instance, init handler::ht with it sql/ha_myisam.h: - ctor moved to .cc to make use of MyISAM handlerton sql/ha_myisammrg.cc: - init handler::ht in the ctor sql/ha_myisammrg.h: - ctor moved to .cc to make use of MyISAM MERGE handlerton sql/ha_ndbcluster.cc: - init handlerton::flags and handler::ht sql/handler.cc: - drop support for ISAM storage engine, which was removed from 5.0 - close all "transient" cursors at COMMIT/ROLLBACK. A "transient" SQL level cursor is a cursor that uses tables that have a transaction- specific state. sql/handler.h: - extend struct handlerton with flags, add handlerton *ht to every handler instance. sql/lock.cc: - extend mysql_lock_tables to send error to the client if thr_multi_lock returns a timeout or a deadlock error. sql/mysqld.cc: - add server option --table_lock_wait_timeout (in seconds) sql/set_var.cc: - add new global variable 'table_lock_wait_timeout' to specify a wait timeout for table-level locks of MySQL (in seconds). The default timeout is 50 seconds. The timeout is active only if the connection has open cursors. sql/sql_class.cc: - implement Statement_map::close_transient_cursors - safety suggests that we need an assert ensuring llock_info->n_cursors is functioning properly, adjust destruction of the Statement_map to allow such assert in THD::~THD sql/sql_class.h: - add support for Cursors registry to Statement map. sql/sql_prepare.cc: - maintain a list of cursors that must be closed at commit/rollback. sql/sql_select.cc: - extend class Cursor to support specific at-COMMIT/ROLLBACK behavior. If a cursor uses tables of a storage engine that invalidates all open tables at COMMIT/ROLLBACK, it must be closed before COMMIT/ROLLBACK is executed. sql/sql_select.h: - add an own lock_id and commit/rollback status flag to class Cursor tests/mysql_client_test.c: A test case for Bug#10760 and complementary issues: test a simple deadlock case too. mysql-test/var: New BitKeeper file ``mysql-test/var''
2005-07-19 20:21:12 +02:00
HTON_NO_FLAGS
};
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
static handler *ndbcluster_create_handler(TABLE_SHARE *table)
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
{
return new ha_ndbcluster(table);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
WL #1729 Handler: error text for NDB errors - New solution after discussions with Sergei, no handler specific code or error messages should be in sql layer. next_result, only check for error if check is -1 Improved index_read include/mysqld_error.h: New error codes ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG, update number to 298. Removed prevoius ER_NDB_ERROR, handler specific error should not be here. sql/ha_ndbcluster.cc: Removed print_error from ha_ndbcluster, added code to handler::print_error to ask handler::get_error_message for message for an error. Fix bug in next_result, only check for error if -1 is returned. Make index_read easier, special case where pk_read or unique_index_read is detected and as default do ordered_index_scan sql/ha_ndbcluster.h: Remplace print_error with get_error_message sql/handler.cc: Add new function get_error_message usedc to ask handler for a message for an error. Call get_error_message from print_error if error code is not known. sql/handler.h: Add new function get_error_message sql/share/czech/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/danish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/dutch/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/english/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/estonian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/french/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/german/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/greek/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/hungarian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/italian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/korean/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian-ny/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/polish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/portuguese/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/romanian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/russian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/serbian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/slovak/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/spanish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/swedish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/ukrainian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG
2004-05-13 11:56:45 +02:00
#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
#define NDB_AUTO_INCREMENT_RETRIES 10
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#define NDB_INVALID_SCHEMA_OBJECT 241
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#define ERR_PRINT(err) \
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
DBUG_PRINT("error", ("%d message: %s", err.code, err.message))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#define ERR_RETURN(err) \
{ \
const NdbError& tmp= err; \
ERR_PRINT(tmp); \
DBUG_RETURN(ndb_to_mysql_error(&tmp)); \
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
#define ERR_BREAK(err, code) \
{ \
const NdbError& tmp= err; \
ERR_PRINT(tmp); \
code= ndb_to_mysql_error(&tmp); \
break; \
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Typedefs for long names
typedef NdbDictionary::Object NDBOBJ;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
typedef NdbDictionary::Column NDBCOL;
typedef NdbDictionary::Table NDBTAB;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
typedef NdbDictionary::Index NDBINDEX;
typedef NdbDictionary::Dictionary NDBDICT;
typedef NdbDictionary::Event NDBEVENT;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
static int ndbcluster_inited= 0;
static int ndbcluster_util_inited= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
static Ndb* g_ndb= NULL;
static Ndb_cluster_connection* g_ndb_cluster_connection= NULL;
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Handler synchronization
pthread_mutex_t ndbcluster_mutex;
// Table lock handling
static HASH ndbcluster_open_tables;
static byte *ndbcluster_get_key(NDB_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)));
static NDB_SHARE *get_share(const char *key,
bool create_if_not_exists= TRUE,
bool have_lock= FALSE);
static void free_share(NDB_SHARE **share, bool have_lock= FALSE);
static void real_free_share(NDB_SHARE **share);
static void ndb_set_fragmentation(NDBTAB &tab, TABLE *table, uint pk_len);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
static int packfrm(const void *data, uint len, const void **pack_data, uint *pack_len);
static int unpackfrm(const void **data, uint *len,
const void* pack_data);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
static int ndb_get_table_statistics(Ndb*, const char *,
struct Ndb_statistics *);
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
#ifndef DBUG_OFF
void print_records(TABLE *table, const char *record)
{
if (_db_on_)
{
for (uint j= 0; j < table->s->fields; j++)
{
char buf[40];
int pos= 0;
Field *field= table->field[j];
const byte* field_ptr= field->ptr - table->record[0] + record;
int pack_len= field->pack_length();
int n= pack_len < 10 ? pack_len : 10;
for (int i= 0; i < n && pos < 20; i++)
{
pos+= sprintf(&buf[pos]," %x", (int) (unsigned char) field_ptr[i]);
}
buf[pos]= 0;
DBUG_PRINT("info",("[%u]field_ptr[0->%d]: %s", j, n, buf));
}
}
}
#else
#define print_records(a,b)
#endif
2005-02-11 22:33:52 +01:00
// Util thread variables
static pthread_t ndb_util_thread;
pthread_mutex_t LOCK_ndb_util_thread;
pthread_cond_t COND_ndb_util_thread;
pthread_handler_t ndb_util_thread_func(void *arg);
2005-02-11 22:33:52 +01:00
ulong ndb_cache_check_time;
/*
Dummy buffer to read zero pack_length fields
which are mapped to 1 char
*/
2004-12-10 16:55:04 +01:00
static uint32 dummy_buf;
/*
Stats that can be retrieved from ndb
*/
struct Ndb_statistics {
Uint64 row_count;
Uint64 commit_count;
Uint64 row_size;
Uint64 fragment_memory;
};
/* Status variables shown with 'show status like 'Ndb%' */
static long ndb_cluster_node_id= 0;
static const char * ndb_connected_host= 0;
static long ndb_connected_port= 0;
static long ndb_number_of_replicas= 0;
static long ndb_number_of_storage_nodes= 0;
static int update_status_variables(Ndb_cluster_connection *c)
{
ndb_cluster_node_id= c->node_id();
ndb_connected_port= c->get_connected_port();
ndb_connected_host= c->get_connected_host();
ndb_number_of_replicas= 0;
ndb_number_of_storage_nodes= c->no_db_nodes();
return 0;
}
struct show_var_st ndb_status_variables[]= {
{"cluster_node_id", (char*) &ndb_cluster_node_id, SHOW_LONG},
{"connected_host", (char*) &ndb_connected_host, SHOW_CHAR_PTR},
{"connected_port", (char*) &ndb_connected_port, SHOW_LONG},
// {"number_of_replicas", (char*) &ndb_number_of_replicas, SHOW_LONG},
{"number_of_storage_nodes",(char*) &ndb_number_of_storage_nodes, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
/* instantiated in storage/ndb/src/ndbapi/Ndbif.cpp */
extern Uint64 g_latest_trans_gci;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Error handling functions
*/
/* Note for merge: old mapping table, moved to storage/ndb/ndberror.c */
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
static int ndb_to_mysql_error(const NdbError *ndberr)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
/* read the mysql mapped error code */
int error= ndberr->mysql_code;
switch (error)
{
/* errors for which we do not add warnings, just return mapped error code
*/
case HA_ERR_NO_SUCH_TABLE:
case HA_ERR_KEY_NOT_FOUND:
case HA_ERR_FOUND_DUPP_KEY:
return error;
/* Mapping missing, go with the ndb error code*/
case -1:
error= ndberr->code;
break;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/* Mapping exists, go with the mapped code */
default:
break;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Push the NDB error message as warning
- Used to be able to use SHOW WARNINGS toget more info on what the error is
- Used by replication to see if the error was temporary
*/
if (ndberr->status == NdbError::TemporaryError)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_TEMPORARY_ERRMSG, ER(ER_GET_TEMPORARY_ERRMSG),
ndberr->code, ndberr->message, "NDB");
else
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
ndberr->code, ndberr->message, "NDB");
return error;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int execute_no_commit_ignore_no_key(ha_ndbcluster *h, NdbTransaction *trans)
{
int res= trans->execute(NdbTransaction::NoCommit,
NdbTransaction::AO_IgnoreError,
h->m_force_send);
if (res == 0)
return 0;
const NdbError &err= trans->getNdbError();
if (err.classification != NdbError::ConstraintViolation &&
err.classification != NdbError::NoDataFound)
return res;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
return 0;
}
2004-09-17 16:58:08 +02:00
inline
int execute_no_commit(ha_ndbcluster *h, NdbTransaction *trans)
2004-09-17 16:58:08 +02:00
{
#ifdef NOT_USED
int m_batch_execute= 0;
if (m_batch_execute)
2004-09-17 16:58:08 +02:00
return 0;
#endif
return h->m_ignore_no_key ?
execute_no_commit_ignore_no_key(h,trans) :
trans->execute(NdbTransaction::NoCommit,
NdbTransaction::AbortOnError,
h->m_force_send);
}
inline
int execute_commit(ha_ndbcluster *h, NdbTransaction *trans)
{
#ifdef NOT_USED
int m_batch_execute= 0;
if (m_batch_execute)
return 0;
#endif
return trans->execute(NdbTransaction::Commit,
NdbTransaction::AbortOnError,
h->m_force_send);
}
inline
int execute_commit(THD *thd, NdbTransaction *trans)
{
#ifdef NOT_USED
int m_batch_execute= 0;
if (m_batch_execute)
return 0;
#endif
return trans->execute(NdbTransaction::Commit,
NdbTransaction::AbortOnError,
thd->variables.ndb_force_send);
}
inline
int execute_no_commit_ie(ha_ndbcluster *h, NdbTransaction *trans)
{
#ifdef NOT_USED
int m_batch_execute= 0;
if (m_batch_execute)
return 0;
#endif
return trans->execute(NdbTransaction::NoCommit,
NdbTransaction::AO_IgnoreError,
h->m_force_send);
2004-09-17 16:58:08 +02:00
}
2004-12-17 21:13:22 +01:00
/*
Place holder for ha_ndbcluster thread specific data
*/
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
Thd_ndb::Thd_ndb()
{
ndb= new Ndb(g_ndb_cluster_connection, "");
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
lock_count= 0;
count= 0;
all= NULL;
stmt= NULL;
error= 0;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
}
Thd_ndb::~Thd_ndb()
{
if (ndb)
{
#ifndef DBUG_OFF
Review fixes of new pushed code - Fixed tests - Optimized new code - Fixed some unlikely core dumps - Better bug fixes for: - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null mysql-test/r/create.result: Update results after removing wrong warnings for CREATE ... SELECT New tests mysql-test/r/handler.result: Drop used tables mysql-test/r/kill.result: Make test portable mysql-test/r/mysqlshow.result: Drop tables used by previous test mysql-test/r/trigger.result: Reuse old procedure name mysql-test/r/view.result: Extra tests mysql-test/t/create.test: New tests to test fix of removing wrong warnings for CREATE ... SELECT mysql-test/t/disabled.def: Enable 'kill' test (should now be portable) mysql-test/t/handler.test: Drop used tables mysql-test/t/kill.test: Make test portable even if kill doesn't work at once mysql-test/t/mysqlshow.test: Drop tables used by previous test mysql-test/t/trigger.test: Reuse old procedure name mysql-test/t/view.test: Extra tests sql/field.cc: Removed compiler warning sql/ha_federated.cc: my_snprintf -> strmake() (Simple optimization) sql/ha_ndbcluster.cc: Indentation cleanups and trival optimization sql/item.cc: Moved save_org_in_field() to item.cc to make it easier to test Remove setting of null_value as this is not needed sql/item.h: Moved save_org_in_field() to item.cc to make it easier to test sql/log_event.cc: Remove inline of slave_load_file_stem() Added 'extension' parameter to slave_load_file_stem() to get smaller code Removed not critical (or needed) DBUG_ASSERT()'s Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths Indentation fixes sql/opt_range.cc: Moved code from declaration to function body (To make it more readable) sql/parse_file.cc: Fixed DBUG_PRINT sql/sp.cc: Simple cleanups - Removed not needed {} level - Ensure saved variables starts with old_ sql/sp_head.cc: Indentation fixes Remove core dump when using --debug when m_next_cached_sp == 0 Fixed compiler warnings Trivial optimizations sql/sp_head.h: Changed argument to set_definer() to const Added THD argument to recursion_level_error() to avoid call to current_thd sql/sql_acl.cc: Removed not needed test (first_not_own_table is the guard) sql/sql_base.cc: Removed extra empty line sql/sql_handler.cc: Don't test table version in mysql_ha_read() as this is already tested in lock_tables() Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables (Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash) sql/sql_insert.cc: Mark fields that are set in CREATE ... SELECT as used (Removed wrong warnings about field not having a default value) sql/sql_parse.cc: Removed not needed test of 'tables' (first_not_own_table is the guard) Simplify code sql/sql_select.cc: Use group->field to check if value is null instead of item called by 'save_org_in_field' This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null) sql/sql_trigger.cc: Move sql_modes_parameters outside of function Indentation fixes Fixed compiler warning Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access() (This allows us to remove the extra test in check_grant() and check_table_access())
2006-01-05 23:47:49 +01:00
Ndb::Free_list_usage tmp;
tmp.m_name= 0;
while (ndb->get_free_list_usage(&tmp))
{
uint leaked= (uint) tmp.m_created - tmp.m_free;
if (leaked)
fprintf(stderr, "NDB: Found %u %s%s that %s not been released\n",
leaked, tmp.m_name,
(leaked == 1)?"":"'s",
(leaked == 1)?"has":"have");
}
#endif
delete ndb;
Review fixes of new pushed code - Fixed tests - Optimized new code - Fixed some unlikely core dumps - Better bug fixes for: - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null mysql-test/r/create.result: Update results after removing wrong warnings for CREATE ... SELECT New tests mysql-test/r/handler.result: Drop used tables mysql-test/r/kill.result: Make test portable mysql-test/r/mysqlshow.result: Drop tables used by previous test mysql-test/r/trigger.result: Reuse old procedure name mysql-test/r/view.result: Extra tests mysql-test/t/create.test: New tests to test fix of removing wrong warnings for CREATE ... SELECT mysql-test/t/disabled.def: Enable 'kill' test (should now be portable) mysql-test/t/handler.test: Drop used tables mysql-test/t/kill.test: Make test portable even if kill doesn't work at once mysql-test/t/mysqlshow.test: Drop tables used by previous test mysql-test/t/trigger.test: Reuse old procedure name mysql-test/t/view.test: Extra tests sql/field.cc: Removed compiler warning sql/ha_federated.cc: my_snprintf -> strmake() (Simple optimization) sql/ha_ndbcluster.cc: Indentation cleanups and trival optimization sql/item.cc: Moved save_org_in_field() to item.cc to make it easier to test Remove setting of null_value as this is not needed sql/item.h: Moved save_org_in_field() to item.cc to make it easier to test sql/log_event.cc: Remove inline of slave_load_file_stem() Added 'extension' parameter to slave_load_file_stem() to get smaller code Removed not critical (or needed) DBUG_ASSERT()'s Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths Indentation fixes sql/opt_range.cc: Moved code from declaration to function body (To make it more readable) sql/parse_file.cc: Fixed DBUG_PRINT sql/sp.cc: Simple cleanups - Removed not needed {} level - Ensure saved variables starts with old_ sql/sp_head.cc: Indentation fixes Remove core dump when using --debug when m_next_cached_sp == 0 Fixed compiler warnings Trivial optimizations sql/sp_head.h: Changed argument to set_definer() to const Added THD argument to recursion_level_error() to avoid call to current_thd sql/sql_acl.cc: Removed not needed test (first_not_own_table is the guard) sql/sql_base.cc: Removed extra empty line sql/sql_handler.cc: Don't test table version in mysql_ha_read() as this is already tested in lock_tables() Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables (Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash) sql/sql_insert.cc: Mark fields that are set in CREATE ... SELECT as used (Removed wrong warnings about field not having a default value) sql/sql_parse.cc: Removed not needed test of 'tables' (first_not_own_table is the guard) Simplify code sql/sql_select.cc: Use group->field to check if value is null instead of item called by 'save_org_in_field' This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null) sql/sql_trigger.cc: Move sql_modes_parameters outside of function Indentation fixes Fixed compiler warning Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access() (This allows us to remove the extra test in check_grant() and check_table_access())
2006-01-05 23:47:49 +01:00
ndb= NULL;
}
changed_tables.empty();
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
}
inline
Thd_ndb *
get_thd_ndb(THD *thd) { return (Thd_ndb *) thd->ha_data[ndbcluster_hton.slot]; }
inline
void
set_thd_ndb(THD *thd, Thd_ndb *thd_ndb) { thd->ha_data[ndbcluster_hton.slot]= thd_ndb; }
inline
Ndb *ha_ndbcluster::get_ndb()
{
return get_thd_ndb(current_thd)->ndb;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
}
/*
* manage uncommitted insert/deletes during transactio to get records correct
*/
struct Ndb_local_table_statistics {
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
int no_uncommitted_rows_count;
ulong last_count;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
ha_rows records;
};
2004-10-04 01:20:05 +02:00
void ha_ndbcluster::set_rec_per_key()
{
DBUG_ENTER("ha_ndbcluster::get_status_const");
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
for (uint i=0 ; i < table->s->keys ; i++)
2004-10-04 01:20:05 +02:00
{
table->key_info[i].rec_per_key[table->key_info[i].key_parts-1]= 1;
}
DBUG_VOID_RETURN;
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
void ha_ndbcluster::records_update()
{
if (m_ha_not_exact_count)
return;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_ENTER("ha_ndbcluster::records_update");
struct Ndb_local_table_statistics *info=
(struct Ndb_local_table_statistics *)m_table_info;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
info->no_uncommitted_rows_count));
// if (info->records == ~(ha_rows)0)
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
{
Ndb *ndb= get_ndb();
struct Ndb_statistics stat;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (ndb_get_table_statistics(ndb, m_tabname, &stat) == 0){
mean_rec_length= stat.row_size;
data_file_length= stat.fragment_memory;
info->records= stat.row_count;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
}
}
{
THD *thd= current_thd;
if (get_thd_ndb(thd)->error)
info->no_uncommitted_rows_count= 0;
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
records= info->records+ info->no_uncommitted_rows_count;
DBUG_VOID_RETURN;
}
void ha_ndbcluster::no_uncommitted_rows_execute_failure()
{
if (m_ha_not_exact_count)
return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_execute_failure");
get_thd_ndb(current_thd)->error= 1;
DBUG_VOID_RETURN;
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
{
if (m_ha_not_exact_count)
return;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_init");
struct Ndb_local_table_statistics *info=
(struct Ndb_local_table_statistics *)m_table_info;
Thd_ndb *thd_ndb= get_thd_ndb(thd);
if (info->last_count != thd_ndb->count)
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
{
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
info->last_count= thd_ndb->count;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
info->no_uncommitted_rows_count= 0;
info->records= ~(ha_rows)0;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
info->no_uncommitted_rows_count));
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
}
DBUG_VOID_RETURN;
}
void ha_ndbcluster::no_uncommitted_rows_update(int c)
{
if (m_ha_not_exact_count)
return;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_update");
struct Ndb_local_table_statistics *info=
(struct Ndb_local_table_statistics *)m_table_info;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
info->no_uncommitted_rows_count+= c;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
((const NDBTAB *)m_table)->getTableId(),
info->no_uncommitted_rows_count));
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_VOID_RETURN;
}
void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
{
if (m_ha_not_exact_count)
return;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_reset");
Thd_ndb *thd_ndb= get_thd_ndb(thd);
thd_ndb->count++;
thd_ndb->error= 0;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_VOID_RETURN;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Take care of the error that occured in NDB
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
RETURN
0 No error
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
# The mapped error code
*/
void
ha_ndbcluster::invalidate_dictionary_cache(TABLE *table, Ndb *ndb,
const char *tabname, bool global)
{
NDBDICT *dict= ndb->getDictionary();
DBUG_ENTER("invalidate_dictionary_cache");
DBUG_PRINT("info", ("invalidating %s", tabname));
if (global)
{
const NDBTAB *tab= dict->getTable(tabname);
if (!tab)
DBUG_VOID_RETURN;
if (tab->getObjectStatus() == NdbDictionary::Object::Invalid)
{
// Global cache has already been invalidated
dict->removeCachedTable(tabname);
global= FALSE;
}
else
dict->invalidateTable(tabname);
}
else
dict->removeCachedTable(tabname);
2005-03-09 23:38:11 +01:00
table->s->version=0L; /* Free when thread is ready */
DBUG_VOID_RETURN;
}
void ha_ndbcluster::invalidate_dictionary_cache(bool global)
{
NDBDICT *dict= get_ndb()->getDictionary();
invalidate_dictionary_cache(table, get_ndb(), m_tabname, global);
/* Invalidate indexes */
2005-03-09 23:38:11 +01:00
for (uint i= 0; i < table->s->keys; i++)
{
NDBINDEX *index = (NDBINDEX *) m_index[i].index;
NDBINDEX *unique_index = (NDBINDEX *) m_index[i].unique_index;
NDB_INDEX_TYPE idx_type= m_index[i].type;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (idx_type) {
case PRIMARY_KEY_ORDERED_INDEX:
case ORDERED_INDEX:
if (global)
dict->invalidateIndex(index->getName(), m_tabname);
else
dict->removeCachedIndex(index->getName(), m_tabname);
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case UNIQUE_ORDERED_INDEX:
if (global)
dict->invalidateIndex(index->getName(), m_tabname);
else
dict->removeCachedIndex(index->getName(), m_tabname);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case UNIQUE_INDEX:
if (global)
dict->invalidateIndex(unique_index->getName(), m_tabname);
else
dict->removeCachedIndex(unique_index->getName(), m_tabname);
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case PRIMARY_KEY_INDEX:
case UNDEFINED_INDEX:
break;
}
}
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
int ha_ndbcluster::ndb_err(NdbTransaction *trans)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int res;
NdbError err= trans->getNdbError();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ndb_err");
ERR_PRINT(err);
switch (err.classification) {
case NdbError::SchemaError:
invalidate_dictionary_cache(TRUE);
if (err.code==284)
{
/*
Check if the table is _really_ gone or if the table has
been alterend and thus changed table id
*/
NDBDICT *dict= get_ndb()->getDictionary();
DBUG_PRINT("info", ("Check if table %s is really gone", m_tabname));
if (!(dict->getTable(m_tabname)))
{
err= dict->getNdbError();
DBUG_PRINT("info", ("Table not found, error: %d", err.code));
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
if (err.code != 709 && err.code != 723)
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("Table exists but must have changed"));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
break;
default:
break;
}
res= ndb_to_mysql_error(&err);
DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d",
err.code, res));
if (res == HA_ERR_FOUND_DUPP_KEY)
{
if (m_rows_to_insert == 1)
2005-06-20 18:02:47 +02:00
m_dupkey= table->s->primary_key;
else
{
/* We are batching inserts, offending key is not available */
m_dupkey= (uint) -1;
}
}
DBUG_RETURN(res);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
/*
WL #1729 Handler: error text for NDB errors - New solution after discussions with Sergei, no handler specific code or error messages should be in sql layer. next_result, only check for error if check is -1 Improved index_read include/mysqld_error.h: New error codes ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG, update number to 298. Removed prevoius ER_NDB_ERROR, handler specific error should not be here. sql/ha_ndbcluster.cc: Removed print_error from ha_ndbcluster, added code to handler::print_error to ask handler::get_error_message for message for an error. Fix bug in next_result, only check for error if -1 is returned. Make index_read easier, special case where pk_read or unique_index_read is detected and as default do ordered_index_scan sql/ha_ndbcluster.h: Remplace print_error with get_error_message sql/handler.cc: Add new function get_error_message usedc to ask handler for a message for an error. Call get_error_message from print_error if error code is not known. sql/handler.h: Add new function get_error_message sql/share/czech/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/danish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/dutch/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/english/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/estonian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/french/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/german/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/greek/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/hungarian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/italian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/korean/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian-ny/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/polish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/portuguese/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/romanian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/russian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/serbian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/slovak/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/spanish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/swedish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/ukrainian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG
2004-05-13 11:56:45 +02:00
Override the default get_error_message in order to add the
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
error message of NDB
*/
bool ha_ndbcluster::get_error_message(int error,
String *buf)
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
{
WL #1729 Handler: error text for NDB errors - New solution after discussions with Sergei, no handler specific code or error messages should be in sql layer. next_result, only check for error if check is -1 Improved index_read include/mysqld_error.h: New error codes ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG, update number to 298. Removed prevoius ER_NDB_ERROR, handler specific error should not be here. sql/ha_ndbcluster.cc: Removed print_error from ha_ndbcluster, added code to handler::print_error to ask handler::get_error_message for message for an error. Fix bug in next_result, only check for error if -1 is returned. Make index_read easier, special case where pk_read or unique_index_read is detected and as default do ordered_index_scan sql/ha_ndbcluster.h: Remplace print_error with get_error_message sql/handler.cc: Add new function get_error_message usedc to ask handler for a message for an error. Call get_error_message from print_error if error code is not known. sql/handler.h: Add new function get_error_message sql/share/czech/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/danish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/dutch/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/english/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/estonian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/french/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/german/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/greek/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/hungarian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/italian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/korean/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian-ny/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/polish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/portuguese/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/romanian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/russian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/serbian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/slovak/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/spanish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/swedish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/ukrainian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG
2004-05-13 11:56:45 +02:00
DBUG_ENTER("ha_ndbcluster::get_error_message");
DBUG_PRINT("enter", ("error: %d", error));
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
Ndb *ndb= get_ndb();
if (!ndb)
DBUG_RETURN(FALSE);
WL #1729 Handler: error text for NDB errors - New solution after discussions with Sergei, no handler specific code or error messages should be in sql layer. next_result, only check for error if check is -1 Improved index_read include/mysqld_error.h: New error codes ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG, update number to 298. Removed prevoius ER_NDB_ERROR, handler specific error should not be here. sql/ha_ndbcluster.cc: Removed print_error from ha_ndbcluster, added code to handler::print_error to ask handler::get_error_message for message for an error. Fix bug in next_result, only check for error if -1 is returned. Make index_read easier, special case where pk_read or unique_index_read is detected and as default do ordered_index_scan sql/ha_ndbcluster.h: Remplace print_error with get_error_message sql/handler.cc: Add new function get_error_message usedc to ask handler for a message for an error. Call get_error_message from print_error if error code is not known. sql/handler.h: Add new function get_error_message sql/share/czech/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/danish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/dutch/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/english/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/estonian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/french/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/german/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/greek/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/hungarian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/italian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/korean/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian-ny/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/polish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/portuguese/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/romanian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/russian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/serbian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/slovak/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/spanish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/swedish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/ukrainian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG
2004-05-13 11:56:45 +02:00
const NdbError err= ndb->getNdbError(error);
bool temporary= err.status==NdbError::TemporaryError;
buf->set(err.message, strlen(err.message), &my_charset_bin);
DBUG_PRINT("exit", ("message: %s, temporary: %d", buf->ptr(), temporary));
DBUG_RETURN(temporary);
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
}
#ifndef DBUG_OFF
2004-07-22 12:38:09 +02:00
/*
Check if type is supported by NDB.
*/
static bool ndb_supported_type(enum_field_types type)
2004-07-22 12:38:09 +02:00
{
switch (type) {
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
2004-12-23 15:28:41 +01:00
case MYSQL_TYPE_BIT:
case MYSQL_TYPE_GEOMETRY:
return TRUE;
2004-07-22 12:38:09 +02:00
case MYSQL_TYPE_NULL:
break;
2004-07-22 12:38:09 +02:00
}
return FALSE;
2004-07-22 12:38:09 +02:00
}
#endif /* !DBUG_OFF */
2004-07-22 12:38:09 +02:00
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Instruct NDB to set the value of the hidden primary key
*/
bool ha_ndbcluster::set_hidden_key(NdbOperation *ndb_op,
uint fieldnr, const byte *field_ptr)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_ENTER("set_hidden_key");
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
DBUG_RETURN(ndb_op->equal(fieldnr, (char*)field_ptr) != 0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Instruct NDB to set the value of one primary key attribute
*/
int ha_ndbcluster::set_ndb_key(NdbOperation *ndb_op, Field *field,
uint fieldnr, const byte *field_ptr)
{
uint32 pack_len= field->pack_length();
DBUG_ENTER("set_ndb_key");
DBUG_PRINT("enter", ("%d: %s, ndb_type: %u, len=%d",
fieldnr, field->field_name, field->type(),
pack_len));
DBUG_DUMP("key", (char*)field_ptr, pack_len);
DBUG_ASSERT(ndb_supported_type(field->type()));
DBUG_ASSERT(! (field->flags & BLOB_FLAG));
// Common implementation for most field types
DBUG_RETURN(ndb_op->equal(fieldnr, (char*) field_ptr, pack_len) != 0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Instruct NDB to set the value of one attribute
*/
int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
uint fieldnr, int row_offset,
bool *set_blob_value)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
const byte* field_ptr= field->ptr + row_offset;
uint32 pack_len= field->pack_length();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("set_ndb_value");
DBUG_PRINT("enter", ("%d: %s type: %u len=%d is_null=%s",
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
fieldnr, field->field_name, field->type(),
pack_len, field->is_null(row_offset) ? "Y" : "N"));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_DUMP("value", (char*) field_ptr, pack_len);
2004-07-22 12:38:09 +02:00
DBUG_ASSERT(ndb_supported_type(field->type()));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
// ndb currently does not support size 0
2004-12-10 16:55:04 +01:00
uint32 empty_field;
if (pack_len == 0)
{
2004-12-10 16:55:04 +01:00
pack_len= sizeof(empty_field);
field_ptr= (byte *)&empty_field;
if (field->is_null(row_offset))
empty_field= 0;
2004-12-10 16:55:04 +01:00
else
empty_field= 1;
}
2004-07-22 12:38:09 +02:00
if (! (field->flags & BLOB_FLAG))
{
2004-12-23 15:28:41 +01:00
if (field->type() != MYSQL_TYPE_BIT)
{
if (field->is_null(row_offset))
{
DBUG_PRINT("info", ("field is NULL"));
// Set value to NULL
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
DBUG_RETURN((ndb_op->setValue(fieldnr, (char*)NULL) != 0));
}
// Common implementation for most field types
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
DBUG_RETURN(ndb_op->setValue(fieldnr, (char*)field_ptr) != 0);
2004-12-23 15:28:41 +01:00
}
else // if (field->type() == MYSQL_TYPE_BIT)
{
longlong bits= field->val_int();
2004-12-23 15:28:41 +01:00
// Round up bit field length to nearest word boundry
pack_len= ((pack_len + 3) >> 2) << 2;
2004-12-23 15:28:41 +01:00
DBUG_ASSERT(pack_len <= 8);
if (field->is_null(row_offset))
2004-12-23 15:28:41 +01:00
// Set value to NULL
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
DBUG_RETURN((ndb_op->setValue(fieldnr, (char*)NULL) != 0));
2004-12-23 15:28:41 +01:00
DBUG_PRINT("info", ("bit field"));
DBUG_DUMP("value", (char*)&bits, pack_len);
2005-01-20 15:50:56 +01:00
#ifdef WORDS_BIGENDIAN
if (pack_len < 5)
{
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
DBUG_RETURN(ndb_op->setValue(fieldnr, ((char*)&bits)+4) != 0);
}
2005-01-20 15:50:56 +01:00
#endif
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
DBUG_RETURN(ndb_op->setValue(fieldnr, (char*)&bits) != 0);
2004-12-23 15:28:41 +01:00
}
2004-07-22 12:38:09 +02:00
}
// Blob type
NdbBlob *ndb_blob= ndb_op->getBlobHandle(fieldnr);
2004-07-22 12:38:09 +02:00
if (ndb_blob != NULL)
{
if (field->is_null(row_offset))
2004-07-22 12:38:09 +02:00
DBUG_RETURN(ndb_blob->setNull() != 0);
Field_blob *field_blob= (Field_blob*)field;
// Get length and pointer to data
uint32 blob_len= field_blob->get_length(field_ptr);
char* blob_ptr= NULL;
field_blob->get_ptr(&blob_ptr);
// Looks like NULL ptr signals length 0 blob
if (blob_ptr == NULL) {
DBUG_ASSERT(blob_len == 0);
blob_ptr= (char*)"";
}
2004-07-22 12:38:09 +02:00
DBUG_PRINT("value", ("set blob ptr=%p len=%u",
blob_ptr, blob_len));
2004-07-22 12:38:09 +02:00
DBUG_DUMP("value", (char*)blob_ptr, min(blob_len, 26));
if (set_blob_value)
*set_blob_value= TRUE;
2004-07-22 12:38:09 +02:00
// No callback needed to write value
DBUG_RETURN(ndb_blob->setValue(blob_ptr, blob_len) != 0);
}
DBUG_RETURN(1);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2004-07-22 12:38:09 +02:00
}
/*
Callback to read all blob values.
- not done in unpack_record because unpack_record is valid
after execute(Commit) but reading blobs is not
- may only generate read operations; they have to be executed
somewhere before the data is available
- due to single buffer for all blobs, we let the last blob
process all blobs (last so that all are active)
- null bit is still set in unpack_record
- TODO allocate blob part aligned buffers
*/
NdbBlob::ActiveHook g_get_ndb_blobs_value;
2004-07-22 12:38:09 +02:00
int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg)
2004-07-22 12:38:09 +02:00
{
DBUG_ENTER("g_get_ndb_blobs_value");
2004-07-22 12:38:09 +02:00
if (ndb_blob->blobsNextBlob() != NULL)
DBUG_RETURN(0);
ha_ndbcluster *ha= (ha_ndbcluster *)arg;
DBUG_RETURN(ha->get_ndb_blobs_value(ndb_blob));
}
int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
{
DBUG_ENTER("get_ndb_blobs_value");
// Field has no field number so cannot use TABLE blob_field
// Loop twice, first only counting total buffer size
for (int loop= 0; loop <= 1; loop++)
{
uint32 offset= 0;
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
for (uint i= 0; i < table->s->fields; i++)
2004-07-22 12:38:09 +02:00
{
Field *field= table->field[i];
NdbValue value= m_value[i];
if (value.ptr != NULL && (field->flags & BLOB_FLAG))
{
Field_blob *field_blob= (Field_blob *)field;
NdbBlob *ndb_blob= value.blob;
Uint64 blob_len= 0;
if (ndb_blob->getLength(blob_len) != 0)
DBUG_RETURN(-1);
// Align to Uint64
uint32 blob_size= blob_len;
if (blob_size % 8 != 0)
blob_size+= 8 - blob_size % 8;
if (loop == 1)
{
char *buf= m_blobs_buffer + offset;
2004-07-22 12:38:09 +02:00
uint32 len= 0xffffffff; // Max uint32
DBUG_PRINT("value", ("read blob ptr=%lx len=%u",
buf, (uint) blob_len));
2004-07-22 12:38:09 +02:00
if (ndb_blob->readData(buf, len) != 0)
DBUG_RETURN(-1);
DBUG_ASSERT(len == blob_len);
field_blob->set_ptr(len, buf);
}
offset+= blob_size;
}
}
if (loop == 0 && offset > m_blobs_buffer_size)
2004-07-22 12:38:09 +02:00
{
my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
m_blobs_buffer_size= 0;
2004-07-22 12:38:09 +02:00
DBUG_PRINT("value", ("allocate blobs buffer size %u", offset));
m_blobs_buffer= my_malloc(offset, MYF(MY_WME));
if (m_blobs_buffer == NULL)
2004-07-22 12:38:09 +02:00
DBUG_RETURN(-1);
m_blobs_buffer_size= offset;
2004-07-22 12:38:09 +02:00
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2004-07-22 12:38:09 +02:00
DBUG_RETURN(0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Instruct NDB to fetch one field
2004-07-22 12:38:09 +02:00
- data is read directly into buffer provided by field
if field is NULL, data is read into memory provided by NDBAPI
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
2004-07-22 12:38:09 +02:00
int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
uint fieldnr, byte* buf)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_ENTER("get_ndb_value");
2004-07-22 12:38:09 +02:00
DBUG_PRINT("enter", ("fieldnr: %d flags: %o", fieldnr,
(int)(field != NULL ? field->flags : 0)));
if (field != NULL)
{
DBUG_ASSERT(buf);
DBUG_ASSERT(ndb_supported_type(field->type()));
2004-07-22 12:38:09 +02:00
DBUG_ASSERT(field->ptr != NULL);
if (! (field->flags & BLOB_FLAG))
{
2004-12-23 15:28:41 +01:00
if (field->type() != MYSQL_TYPE_BIT)
{
byte *field_buf;
if (field->pack_length() != 0)
field_buf= buf + (field->ptr - table->record[0]);
else
field_buf= (byte *)&dummy_buf;
m_value[fieldnr].rec= ndb_op->getValue(fieldnr,
field_buf);
}
2004-12-23 15:28:41 +01:00
else // if (field->type() == MYSQL_TYPE_BIT)
{
m_value[fieldnr].rec= ndb_op->getValue(fieldnr);
}
2004-07-22 12:38:09 +02:00
DBUG_RETURN(m_value[fieldnr].rec == NULL);
}
// Blob type
NdbBlob *ndb_blob= ndb_op->getBlobHandle(fieldnr);
m_value[fieldnr].blob= ndb_blob;
if (ndb_blob != NULL)
{
// Set callback
void *arg= (void *)this;
DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0);
2004-07-22 12:38:09 +02:00
}
DBUG_RETURN(1);
}
// Used for hidden key only
m_value[fieldnr].rec= ndb_op->getValue(fieldnr, NULL);
DBUG_RETURN(m_value[fieldnr].rec == NULL);
}
/*
Check if any set or get of blob value in current query.
*/
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
bool ha_ndbcluster::uses_blob_value()
2004-07-22 12:38:09 +02:00
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->blob_fields == 0)
return FALSE;
2004-07-22 12:38:09 +02:00
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
uint no_fields= table->s->fields;
2004-07-22 12:38:09 +02:00
int i;
// They always put blobs at the end..
for (i= no_fields - 1; i >= 0; i--)
{
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
if ((m_write_op && ha_get_bit_in_write_set(i+1)) ||
(!m_write_op && ha_get_bit_in_read_set(i+1)))
2004-07-22 12:38:09 +02:00
{
return TRUE;
2004-07-22 12:38:09 +02:00
}
}
}
return FALSE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Get metadata for this table from NDB
IMPLEMENTATION
- check that frm-file on disk is equal to frm-file
of table accessed in NDB
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
RETURN
0 ok
-2 Meta data has changed; Re-read data and try again
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
static int cmp_frm(const NDBTAB *ndbtab, const void *pack_data,
uint pack_length)
{
DBUG_ENTER("cmp_frm");
/*
Compare FrmData in NDB with frm file from disk.
*/
if ((pack_length != ndbtab->getFrmLength()) ||
(memcmp(pack_data, ndbtab->getFrmData(), pack_length)))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::get_metadata(const char *path)
{
Ndb *ndb= get_ndb();
NDBDICT *dict= ndb->getDictionary();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
const NDBTAB *tab;
int error;
bool invalidating_ndb_table= FALSE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("get_metadata");
DBUG_PRINT("enter", ("m_tabname: %s, path: %s", m_tabname, path));
do {
const void *data, *pack_data;
uint length, pack_length;
if (!(tab= dict->getTable(m_tabname)))
ERR_RETURN(dict->getNdbError());
// Check if thread has stale local cache
if (tab->getObjectStatus() == NdbDictionary::Object::Invalid)
{
invalidate_dictionary_cache(FALSE);
if (!(tab= dict->getTable(m_tabname)))
ERR_RETURN(dict->getNdbError());
DBUG_PRINT("info", ("Table schema version: %d", tab->getObjectVersion()));
}
/*
Compare FrmData in NDB with frm file from disk.
*/
error= 0;
if (readfrm(path, &data, &length) ||
packfrm(data, length, &pack_data, &pack_length))
{
my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(1);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (cmp_frm(tab, pack_data, pack_length))
{
if (!invalidating_ndb_table)
{
DBUG_PRINT("info", ("Invalidating table"));
invalidate_dictionary_cache(TRUE);
invalidating_ndb_table= TRUE;
}
else
{
DBUG_PRINT("error",
("metadata, pack_length: %d getFrmLength: %d memcmp: %d",
pack_length, tab->getFrmLength(),
memcmp(pack_data, tab->getFrmData(), pack_length)));
DBUG_DUMP("pack_data", (char*)pack_data, pack_length);
DBUG_DUMP("frm", (char*)tab->getFrmData(), tab->getFrmLength());
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
error= HA_ERR_TABLE_DEF_CHANGED;
invalidating_ndb_table= FALSE;
}
}
else
{
invalidating_ndb_table= FALSE;
}
my_free((char*)data, MYF(0));
my_free((char*)pack_data, MYF(0));
} while (invalidating_ndb_table);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (error)
DBUG_RETURN(error);
m_table_version= tab->getObjectVersion();
m_table= (void *)tab;
m_table_info= NULL; // Set in external lock
DBUG_RETURN(build_index_list(ndb, table, ILBP_OPEN));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
const NDBINDEX *index,
KEY *key_info)
{
DBUG_ENTER("fix_unique_index_attr_order");
unsigned sz= index->getNoOfIndexColumns();
if (data.unique_index_attrid_map)
my_free((char*)data.unique_index_attrid_map, MYF(0));
data.unique_index_attrid_map= (unsigned char*)my_malloc(sz,MYF(MY_WME));
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
DBUG_ASSERT(key_info->key_parts == sz);
for (unsigned i= 0; key_part != end; key_part++, i++)
{
const char *field_name= key_part->field->field_name;
#ifndef DBUG_OFF
data.unique_index_attrid_map[i]= 255;
#endif
for (unsigned j= 0; j < sz; j++)
{
const NDBCOL *c= index->getColumn(j);
BUG#9626 - Fix valgrind warnings - Remove static db, schema and table name buffers from Ndb.cpp mysys/thr_alarm.c: Initialise sact to zero ndb/include/kernel/ndb_limits.h: Set MAX_ATTR_NAME_SIZE to NAME_LEN which is tha maximum in MySQL ndb/include/kernel/signaldata/GetTabInfo.hpp: Clean up ndb/include/ndbapi/Ndb.hpp: Remove NDB_MAX_INTERNAL_NAME_LENGTH and all char buffers for schema, db and tablename. Made them dynamic and moved to NdbImpl.hpp ndb/include/ndbapi/ndbapi_limits.h: Remove the static length's of attr, db, schema and table name. ndb/src/common/transporter/Packer.cpp: Set theSignalId to ~0 when unpacking signal ndb/src/ndbapi/Ndb.cpp: Moved schema, database and tablename to NdbImpl.hpp ndb/src/ndbapi/NdbDictionaryImpl.cpp: Add NdbIndexImpl::init and NdbEventImpl::init Init all vars in NdbIndexImpl, NdbEventImpl, NdbTableImpl and NdbIndexImpl Delete the pseudo column NDB$RANGE_NO Copy tablename to internal buff in NdbDictInterface to get proper alignment. Convert length of table name from bytes words, when setting sz of LinearSectionPtr Set LinearSectionPtr array size to number of LinearSections used - save some stack. ndb/src/ndbapi/NdbDictionaryImpl.hpp: Add NdbEventImpl::init and NdbIndexImpl::init Remove clearNewProperties and copyNewProperties, it's easier to check if all vars are initied if it's done in the same func. Add buffer for tabname ti NdbDictInterface, memset it to 0 in initializer. ndb/src/ndbapi/NdbImpl.hpp: Use BaseString for table, schema and db names. ndb/src/ndbapi/Ndbinit.cpp: Move schema and db name to NdbImpl and use BaseString ndb/src/ndbapi/ndb_cluster_connection.cpp: Destroy ndb_global_event_buffer_mutex and ndb_print_state_mutex sql/ha_ndbcluster.cc: Check if pTrans is not null before calling closeTransaction Remove NDB_MAX_ATTR_NAME_SIZE Remove truncation of attr names. When attr name length is same in NDB as in MySQL this will be checked in functin check_column_name
2005-05-18 20:50:29 +02:00
if (strcmp(field_name, c->getName()) == 0)
{
data.unique_index_attrid_map[i]= j;
break;
}
}
DBUG_ASSERT(data.unique_index_attrid_map[i] != 255);
}
DBUG_RETURN(0);
}
2004-08-19 11:10:35 +02:00
int ha_ndbcluster::build_index_list(Ndb *ndb, TABLE *tab, enum ILBP phase)
{
uint i;
2004-08-19 11:10:35 +02:00
int error= 0;
const char *index_name;
char unique_index_name[FN_LEN];
static const char* unique_suffix= "$unique";
2004-08-19 11:10:35 +02:00
KEY* key_info= tab->key_info;
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
const char **key_name= tab->s->keynames.type_names;
NDBDICT *dict= ndb->getDictionary();
DBUG_ENTER("ha_ndbcluster::build_index_list");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Save information about all known indexes
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
for (i= 0; i < tab->s->keys; i++, key_info++, key_name++)
{
2004-08-19 11:10:35 +02:00
index_name= *key_name;
NDB_INDEX_TYPE idx_type= get_index_type_from_table(i);
m_index[i].type= idx_type;
if (idx_type == UNIQUE_ORDERED_INDEX || idx_type == UNIQUE_INDEX)
{
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
strxnmov(unique_index_name, FN_LEN-1, index_name, unique_suffix, NullS);
DBUG_PRINT("info", ("Created unique index name \'%s\' for index %d",
unique_index_name, i));
}
2004-08-19 11:10:35 +02:00
// Create secondary indexes if in create phase
if (phase == ILBP_CREATE)
{
DBUG_PRINT("info", ("Creating index %u: %s", i, index_name));
switch (idx_type){
2004-08-19 11:10:35 +02:00
case PRIMARY_KEY_INDEX:
// Do nothing, already created
break;
2004-08-19 11:10:35 +02:00
case PRIMARY_KEY_ORDERED_INDEX:
error= create_ordered_index(index_name, key_info);
break;
2004-08-19 11:10:35 +02:00
case UNIQUE_ORDERED_INDEX:
if (!(error= create_ordered_index(index_name, key_info)))
error= create_unique_index(unique_index_name, key_info);
break;
2004-08-19 11:10:35 +02:00
case UNIQUE_INDEX:
if (!(error= check_index_fields_not_null(i)))
error= create_unique_index(unique_index_name, key_info);
break;
2004-08-19 11:10:35 +02:00
case ORDERED_INDEX:
error= create_ordered_index(index_name, key_info);
break;
2004-08-19 11:10:35 +02:00
default:
DBUG_ASSERT(FALSE);
break;
2004-08-19 11:10:35 +02:00
}
if (error)
{
DBUG_PRINT("error", ("Failed to create index %u", i));
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
intern_drop_table();
break;
2004-08-19 11:10:35 +02:00
}
}
// Add handles to index objects
if (idx_type != PRIMARY_KEY_INDEX && idx_type != UNIQUE_INDEX)
{
DBUG_PRINT("info", ("Get handle to index %s", index_name));
2004-08-19 11:10:35 +02:00
const NDBINDEX *index= dict->getIndex(index_name, m_tabname);
if (!index) DBUG_RETURN(1);
2004-08-19 07:33:35 +02:00
m_index[i].index= (void *) index;
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
// ordered index - add stats
NDB_INDEX_DATA& d=m_index[i];
delete d.index_stat;
d.index_stat=NULL;
THD *thd=current_thd;
if (thd->variables.ndb_index_stat_enable)
{
d.index_stat=new NdbIndexStat(index);
d.index_stat_cache_entries=thd->variables.ndb_index_stat_cache_entries;
d.index_stat_update_freq=thd->variables.ndb_index_stat_update_freq;
d.index_stat_query_count=0;
d.index_stat->alloc_cache(d.index_stat_cache_entries);
DBUG_PRINT("info", ("index %s stat=on cache_entries=%u update_freq=%u",
index->getName(),
d.index_stat_cache_entries,
d.index_stat_update_freq));
} else
{
DBUG_PRINT("info", ("index %s stat=off", index->getName()));
}
}
if (idx_type == UNIQUE_ORDERED_INDEX || idx_type == UNIQUE_INDEX)
{
DBUG_PRINT("info", ("Get handle to unique_index %s", unique_index_name));
const NDBINDEX *index= dict->getIndex(unique_index_name, m_tabname);
if (!index) DBUG_RETURN(1);
2004-08-19 07:33:35 +02:00
m_index[i].unique_index= (void *) index;
error= fix_unique_index_attr_order(m_index[i], index, key_info);
}
}
2004-08-19 11:10:35 +02:00
DBUG_RETURN(error);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Decode the type of an index from information
provided in table object
*/
NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
bool is_hash_index= (table_share->key_info[inx].algorithm ==
HA_KEY_ALG_HASH);
if (inx == table_share->primary_key)
return is_hash_index ? PRIMARY_KEY_INDEX : PRIMARY_KEY_ORDERED_INDEX;
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
return ((table_share->key_info[inx].flags & HA_NOSAME) ?
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
(is_hash_index ? UNIQUE_INDEX : UNIQUE_ORDERED_INDEX) :
ORDERED_INDEX);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::check_index_fields_not_null(uint inx)
{
KEY* key_info= table->key_info + inx;
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
DBUG_ENTER("ha_ndbcluster::check_index_fields_not_null");
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
if (field->maybe_null())
{
my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX),
MYF(0),field->field_name);
DBUG_RETURN(ER_NULL_COLUMN_IN_INDEX);
}
}
DBUG_RETURN(0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
void ha_ndbcluster::release_metadata()
{
uint i;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("release_metadata");
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
m_table= NULL;
2004-09-21 14:52:56 +02:00
m_table_info= NULL;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Release index list
for (i= 0; i < MAX_KEY; i++)
{
m_index[i].unique_index= NULL;
m_index[i].index= NULL;
if (m_index[i].unique_index_attrid_map)
{
my_free((char *)m_index[i].unique_index_attrid_map, MYF(0));
m_index[i].unique_index_attrid_map= NULL;
}
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
delete m_index[i].index_stat;
m_index[i].index_stat=NULL;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_VOID_RETURN;
}
2004-07-22 12:38:09 +02:00
int ha_ndbcluster::get_ndb_lock_type(enum thr_lock_type type)
{
if (type >= TL_WRITE_ALLOW_WRITE)
2004-09-29 01:42:34 +02:00
return NdbOperation::LM_Exclusive;
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
else if (uses_blob_value())
return NdbOperation::LM_Read;
2004-07-22 12:38:09 +02:00
else
2004-09-29 01:42:34 +02:00
return NdbOperation::LM_CommittedRead;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
static const ulong index_type_flags[]=
{
/* UNDEFINED_INDEX */
0,
/* PRIMARY_KEY_INDEX */
HA_ONLY_WHOLE_INDEX,
/* PRIMARY_KEY_ORDERED_INDEX */
/*
2004-06-24 14:49:34 +02:00
Enable HA_KEYREAD_ONLY when "sorted" indexes are supported,
thus ORDERD BY clauses can be optimized by reading directly
through the index.
*/
2004-06-24 14:49:34 +02:00
// HA_KEYREAD_ONLY |
HA_READ_NEXT |
HA_READ_PREV |
HA_READ_RANGE |
HA_READ_ORDER,
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/* UNIQUE_INDEX */
HA_ONLY_WHOLE_INDEX,
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/* UNIQUE_ORDERED_INDEX */
HA_READ_NEXT |
HA_READ_PREV |
HA_READ_RANGE |
HA_READ_ORDER,
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/* ORDERED_INDEX */
HA_READ_NEXT |
HA_READ_PREV |
HA_READ_RANGE |
HA_READ_ORDER
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
};
static const int index_flags_size= sizeof(index_type_flags)/sizeof(ulong);
inline NDB_INDEX_TYPE ha_ndbcluster::get_index_type(uint idx_no) const
{
DBUG_ASSERT(idx_no < MAX_KEY);
return m_index[idx_no].type;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Get the flags for an index
RETURN
flags depending on the type of the index.
*/
New handler::index_flags() definition to make it easy to check the full used key and a specific key part. Added key part to optimize_range() to fix problems when using fields in key parts. sql/examples/ha_archive.h: New handler::index_flags() definition sql/examples/ha_example.h: New handler::index_flags() definition sql/field.cc: New optimize_range() definition sql/field.h: New optimize_range() definition sql/ha_berkeley.cc: New handler::index_flags() definition sql/ha_berkeley.h: New handler::index_flags() definition sql/ha_heap.h: New handler::index_flags() definition sql/ha_innodb.h: New handler::index_flags() definition sql/ha_isam.h: New handler::index_flags() definition sql/ha_isammrg.h: New handler::index_flags() definition sql/ha_myisam.h: New handler::index_flags() definition sql/ha_myisammrg.h: New handler::index_flags() definition sql/ha_ndbcluster.cc: New handler::index_flags() definition sql/ha_ndbcluster.h: New handler::index_flags() definition sql/handler.h: New handler::index_flags() definition sql/log.cc: Fixed compiler warnings sql/log_event.cc: Fixed compiler warnings (and renamed short variable name) sql/opt_range.cc: New handler::index_flags() definition sql/opt_sum.cc: New handler::index_flags() definition sql/set_var.cc: Removed compiler warnings sql/sql_db.cc: Removed compiler warnings sql/sql_select.cc: New handler::index_flags() definition sql/sql_show.cc: Removed compiler warnings sql/sql_update.cc: Removed compiler warnings sql/table.cc: New handler::index_flags() definition
2004-07-08 14:45:25 +02:00
inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part,
bool all_parts) const
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_ENTER("ha_ndbcluster::index_flags");
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
DBUG_PRINT("enter", ("idx_no: %u", idx_no));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ASSERT(get_index_type_from_table(idx_no) < index_flags_size);
DBUG_RETURN(index_type_flags[get_index_type_from_table(idx_no)] |
HA_KEY_SCAN_NOT_ROR);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
static void shrink_varchar(Field* field, const byte* & ptr, char* buf)
{
if (field->type() == MYSQL_TYPE_VARCHAR && ptr != NULL) {
Field_varstring* f= (Field_varstring*)field;
if (f->length_bytes == 1) {
uint pack_len= field->pack_length();
DBUG_ASSERT(1 <= pack_len && pack_len <= 256);
if (ptr[1] == 0) {
buf[0]= ptr[0];
} else {
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
DBUG_ASSERT(FALSE);
buf[0]= 255;
}
memmove(buf + 1, ptr + 2, pack_len - 1);
ptr= buf;
}
}
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::set_primary_key(NdbOperation *op, const byte *key)
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
KEY* key_info= table->key_info + table->s->primary_key;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
DBUG_ENTER("set_primary_key");
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
const byte* ptr= key;
char buf[256];
shrink_varchar(field, ptr, buf);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (set_ndb_key(op, field,
key_part->fieldnr-1, ptr))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(op->getNdbError());
key += key_part->store_length;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
DBUG_RETURN(0);
}
int ha_ndbcluster::set_primary_key_from_record(NdbOperation *op, const byte *record)
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
KEY* key_info= table->key_info + table->s->primary_key;
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
DBUG_ENTER("set_primary_key_from_record");
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
if (set_ndb_key(op, field,
key_part->fieldnr-1, record+key_part->offset))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(op->getNdbError());
}
DBUG_RETURN(0);
}
int
ha_ndbcluster::set_index_key(NdbOperation *op,
const KEY *key_info,
const byte * key_ptr)
{
DBUG_ENTER("ha_ndbcluster::set_index_key");
uint i;
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
for (i= 0; key_part != end; key_part++, i++)
{
Field* field= key_part->field;
const byte* ptr= key_part->null_bit ? key_ptr + 1 : key_ptr;
char buf[256];
shrink_varchar(field, ptr, buf);
if (set_ndb_key(op, field, m_index[active_index].unique_index_attrid_map[i], ptr))
ERR_RETURN(m_active_trans->getNdbError());
key_ptr+= key_part->store_length;
}
DBUG_RETURN(0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
inline
int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
{
uint i;
DBUG_ENTER("define_read_attrs");
// Define attributes to read
for (i= 0; i < table->s->fields; i++)
{
Field *field= table->field[i];
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
if (ha_get_bit_in_read_set(i+1) ||
((field->flags & PRI_KEY_FLAG)))
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(op->getNdbError());
}
else
{
m_value[i].ptr= NULL;
}
}
if (table->s->primary_key == MAX_KEY)
{
DBUG_PRINT("info", ("Getting hidden key"));
// Scanning table with no primary key
int hidden_no= table->s->fields;
#ifndef DBUG_OFF
const NDBTAB *tab= (const NDBTAB *) m_table;
if (!tab->getColumn(hidden_no))
DBUG_RETURN(1);
#endif
if (get_ndb_value(op, NULL, hidden_no, NULL))
ERR_RETURN(op->getNdbError());
}
DBUG_RETURN(0);
}
Merge BitKeeper/etc/logging_ok: auto-union BUILD/autorun.sh: Auto merged BitKeeper/etc/config: Auto merged Makefile.am: Auto merged include/my_bitmap.h: Auto merged libmysqld/Makefile.am: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysys/Makefile.am: Auto merged mysys/default.c: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged sql/Makefile.am: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_ndbcluster.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/heap/Makefile.am: Auto merged storage/heap/hp_hash.c: Auto merged storage/innobase/btr/btr0btr.c: Auto merged storage/innobase/btr/btr0cur.c: Auto merged storage/innobase/configure.in: Auto merged storage/innobase/fil/fil0fil.c: Auto merged storage/innobase/ibuf/ibuf0ibuf.c: Auto merged storage/innobase/include/os0file.h: Auto merged storage/innobase/include/page0cur.h: Auto merged storage/innobase/include/row0mysql.h: Auto merged storage/innobase/include/srv0srv.h: Auto merged storage/innobase/include/trx0trx.h: Auto merged storage/innobase/include/trx0trx.ic: Auto merged storage/innobase/lock/lock0lock.c: Auto merged storage/innobase/log/log0recv.c: Auto merged storage/innobase/os/os0file.c: Auto merged storage/innobase/page/page0cur.c: Auto merged storage/innobase/page/page0page.c: Auto merged storage/innobase/rem/rem0rec.c: Auto merged storage/innobase/row/row0mysql.c: Auto merged storage/innobase/row/row0sel.c: Auto merged storage/innobase/row/row0upd.c: Auto merged storage/innobase/srv/srv0srv.c: Auto merged storage/innobase/trx/trx0trx.c: Auto merged storage/innobase/trx/trx0undo.c: Auto merged storage/myisam/Makefile.am: Auto merged storage/myisam/mi_create.c: Auto merged storage/myisam/mi_open.c: Auto merged storage/myisam/mi_packrec.c: Auto merged storage/myisam/mi_unique.c: Auto merged storage/myisam/myisampack.c: Auto merged storage/myisammrg/Makefile.am: Auto merged storage/ndb/include/mgmcommon/ConfigRetriever.hpp: Auto merged storage/ndb/include/transporter/TransporterDefinitions.hpp: Auto merged storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Auto merged storage/ndb/src/mgmsrv/main.cpp: Auto merged storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged storage/ndb/test/ndbapi/create_tab.cpp: Auto merged storage/ndb/test/ndbapi/testBlobs.cpp: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-ucs2.c: Auto merged support-files/mysql.spec.sh: Auto merged configure.in: merge mysql-test/t/disabled.def: merge mysys/my_bitmap.c: SCCS merged sql/ha_federated.cc: merge sql/ha_innodb.cc: merge sql/ha_ndbcluster.cc: merge sql/mysqld.cc: e merge sql/sql_insert.cc: merge sql/sql_lex.h: merge sql/sql_load.cc: merge sql/sql_select.cc: merge e C sql/sql_update.cc: merge sql/table.cc: merge
2005-07-12 20:01:22 +02:00
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Read one record from NDB using primary key
*/
2005-07-18 13:31:02 +02:00
int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf,
uint32 part_id)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
uint no_fields= table->s->fields;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbConnection *trans= m_active_trans;
NdbOperation *op;
int res;
DBUG_ENTER("pk_read");
DBUG_PRINT("enter", ("key_len: %u", key_len));
DBUG_DUMP("key", (char*)key, key_len);
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= FALSE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)) ||
op->readTuple(lm) != 0)
ERR_RETURN(trans->getNdbError());
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
op->setPartitionId(part_id);
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->primary_key == MAX_KEY)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
// This table has no primary key, use "hidden" primary key
DBUG_PRINT("info", ("Using hidden key"));
DBUG_DUMP("key", (char*)key, 8);
if (set_hidden_key(op, no_fields, key))
ERR_RETURN(trans->getNdbError());
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Read key at the same time, for future reference
if (get_ndb_value(op, NULL, no_fields, NULL))
ERR_RETURN(trans->getNdbError());
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
else
{
if ((res= set_primary_key(op, key)))
return res;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if ((res= define_read_attrs(buf, op)))
DBUG_RETURN(res);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (execute_no_commit_ie(this,trans) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans));
}
// The value have now been fetched from NDB
unpack_record(buf);
table->status= 0;
DBUG_RETURN(0);
}
/*
Read one complementing record from NDB using primary key from old_data
*/
2005-07-18 13:31:02 +02:00
int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data,
uint32 old_part_id)
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
uint no_fields= table->s->fields, i;
NdbTransaction *trans= m_active_trans;
NdbOperation *op;
DBUG_ENTER("complemented_pk_read");
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= FALSE;
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
if (ha_get_all_bit_in_read_set())
{
// We have allready retrieved all fields, nothing to complement
DBUG_RETURN(0);
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
}
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)) ||
op->readTuple(lm) != 0)
ERR_RETURN(trans->getNdbError());
int res;
2005-07-04 20:36:38 +02:00
if ((res= set_primary_key_from_record(op, old_data)))
ERR_RETURN(trans->getNdbError());
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
op->setPartitionId(old_part_id);
// Read all unreferenced non-key field(s)
for (i= 0; i < no_fields; i++)
{
Field *field= table->field[i];
if (!((field->flags & PRI_KEY_FLAG) ||
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
(ha_get_bit_in_read_set(i+1))))
{
if (get_ndb_value(op, field, i, new_data))
ERR_RETURN(trans->getNdbError());
}
}
2004-09-17 16:58:08 +02:00
if (execute_no_commit(this,trans) != 0)
{
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans));
}
// The value have now been fetched from NDB
unpack_record(new_data);
table->status= 0;
/**
* restore m_value
*/
for (i= 0; i < no_fields; i++)
{
Field *field= table->field[i];
if (!((field->flags & PRI_KEY_FLAG) ||
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
(ha_get_bit_in_read_set(i+1))))
{
m_value[i].ptr= NULL;
}
}
DBUG_RETURN(0);
}
/*
Peek to check if a particular row already exists
*/
int ha_ndbcluster::peek_row(const byte *record)
{
NdbTransaction *trans= m_active_trans;
NdbOperation *op;
DBUG_ENTER("peek_row");
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)) ||
op->readTuple(lm) != 0)
ERR_RETURN(trans->getNdbError());
int res;
if ((res= set_primary_key_from_record(op, record)))
ERR_RETURN(trans->getNdbError());
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
{
uint32 part_id;
int error;
if ((error= m_part_info->get_partition_id(m_part_info, &part_id)))
{
DBUG_RETURN(error);
}
op->setPartitionId(part_id);
}
if (execute_no_commit_ie(this,trans) != 0)
{
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans));
}
DBUG_RETURN(0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Read one record from NDB using unique secondary index
*/
int ha_ndbcluster::unique_index_read(const byte *key,
uint key_len, byte *buf)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int res;
NdbTransaction *trans= m_active_trans;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbIndexOperation *op;
DBUG_ENTER("ha_ndbcluster::unique_index_read");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("key_len: %u, index: %u", key_len, active_index));
DBUG_DUMP("key", (char*)key, key_len);
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
if (!(op= trans->getNdbIndexOperation((NDBINDEX *)
m_index[active_index].unique_index,
(const NDBTAB *) m_table)) ||
op->readTuple(lm) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(trans->getNdbError());
// Set secondary index key(s)
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if ((res= set_index_key(op, table->key_info + active_index, key)))
DBUG_RETURN(res);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if ((res= define_read_attrs(buf, op)))
DBUG_RETURN(res);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (execute_no_commit_ie(this,trans) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(ndb_err(trans));
}
// The value have now been fetched from NDB
unpack_record(buf);
table->status= 0;
DBUG_RETURN(0);
}
inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
DBUG_ENTER("fetch_next");
int check;
NdbTransaction *trans= m_active_trans;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
bool contact_ndb= m_lock.type < TL_WRITE_ALLOW_WRITE;
do {
DBUG_PRINT("info", ("Call nextResult, contact_ndb: %d", contact_ndb));
2004-07-22 12:38:09 +02:00
/*
We can only handle one tuple with blobs at a time.
*/
if (m_ops_pending && m_blobs_pending)
2004-07-22 12:38:09 +02:00
{
2004-09-17 16:58:08 +02:00
if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans));
m_ops_pending= 0;
m_blobs_pending= FALSE;
2004-07-22 12:38:09 +02:00
}
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
if ((check= cursor->nextResult(contact_ndb, m_force_send)) == 0)
{
DBUG_RETURN(0);
}
else if (check == 1 || check == 2)
{
// 1: No more records
// 2: No more cached records
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
/*
Before fetching more rows and releasing lock(s),
all pending update or delete operations should
be sent to NDB
*/
DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
if (m_ops_pending)
{
if (m_transaction_on)
{
if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(-1);
}
else
{
if (execute_commit(this,trans) != 0)
DBUG_RETURN(-1);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (trans->restart() != 0)
{
DBUG_ASSERT(0);
DBUG_RETURN(-1);
}
}
m_ops_pending= 0;
}
contact_ndb= (check == 2);
}
else
{
DBUG_RETURN(-1);
}
} while (check == 2);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
DBUG_RETURN(1);
}
/*
Get the next record of a started scan. Try to fetch
it locally from NdbApi cached records if possible,
otherwise ask NDB for more.
NOTE
If this is a update/delete make sure to not contact
NDB before any pending ops have been sent to NDB.
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
*/
inline int ha_ndbcluster::next_result(byte *buf)
{
int res;
DBUG_ENTER("next_result");
if (!m_active_cursor)
DBUG_RETURN(HA_ERR_END_OF_FILE);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if ((res= fetch_next(m_active_cursor)) == 0)
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
DBUG_PRINT("info", ("One more record found"));
unpack_record(buf);
table->status= 0;
DBUG_RETURN(0);
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
else if (res == 1)
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
// No more records
table->status= STATUS_NOT_FOUND;
DBUG_PRINT("info", ("No more records"));
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
else
{
DBUG_RETURN(ndb_err(m_active_trans));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Set bounds for ordered index scan.
*/
int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
uint inx,
bool rir,
const key_range *keys[2],
uint range_no)
{
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
const KEY *const key_info= table->key_info + inx;
const uint key_parts= key_info->key_parts;
uint key_tot_len[2];
uint tot_len;
uint i, j;
DBUG_ENTER("set_bounds");
DBUG_PRINT("info", ("key_parts=%d", key_parts));
for (j= 0; j <= 1; j++)
{
const key_range *key= keys[j];
if (key != NULL)
{
// for key->flag see ha_rkey_function
DBUG_PRINT("info", ("key %d length=%d flag=%d",
j, key->length, key->flag));
key_tot_len[j]= key->length;
}
else
{
DBUG_PRINT("info", ("key %d not present", j));
key_tot_len[j]= 0;
}
}
tot_len= 0;
2004-08-31 10:19:10 +02:00
for (i= 0; i < key_parts; i++)
{
KEY_PART_INFO *key_part= &key_info->key_part[i];
Field *field= key_part->field;
#ifndef DBUG_OFF
uint part_len= key_part->length;
#endif
uint part_store_len= key_part->store_length;
// Info about each key part
struct part_st {
bool part_last;
const key_range *key;
const byte *part_ptr;
bool part_null;
int bound_type;
const char* bound_ptr;
};
struct part_st part[2];
for (j= 0; j <= 1; j++)
{
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
struct part_st &p= part[j];
p.key= NULL;
p.bound_type= -1;
if (tot_len < key_tot_len[j])
{
p.part_last= (tot_len + part_store_len >= key_tot_len[j]);
p.key= keys[j];
p.part_ptr= &p.key->key[tot_len];
p.part_null= key_part->null_bit && *p.part_ptr;
p.bound_ptr= (const char *)
p.part_null ? 0 : key_part->null_bit ? p.part_ptr + 1 : p.part_ptr;
if (j == 0)
{
switch (p.key->flag)
{
case HA_READ_KEY_EXACT:
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
if (! rir)
p.bound_type= NdbIndexScanOperation::BoundEQ;
else // differs for records_in_range
p.bound_type= NdbIndexScanOperation::BoundLE;
break;
// ascending
case HA_READ_KEY_OR_NEXT:
p.bound_type= NdbIndexScanOperation::BoundLE;
break;
case HA_READ_AFTER_KEY:
if (! p.part_last)
p.bound_type= NdbIndexScanOperation::BoundLE;
else
p.bound_type= NdbIndexScanOperation::BoundLT;
break;
// descending
case HA_READ_PREFIX_LAST: // weird
p.bound_type= NdbIndexScanOperation::BoundEQ;
break;
case HA_READ_PREFIX_LAST_OR_PREV: // weird
p.bound_type= NdbIndexScanOperation::BoundGE;
break;
case HA_READ_BEFORE_KEY:
if (! p.part_last)
p.bound_type= NdbIndexScanOperation::BoundGE;
else
p.bound_type= NdbIndexScanOperation::BoundGT;
break;
default:
break;
}
}
if (j == 1) {
switch (p.key->flag)
{
// ascending
case HA_READ_BEFORE_KEY:
if (! p.part_last)
p.bound_type= NdbIndexScanOperation::BoundGE;
else
p.bound_type= NdbIndexScanOperation::BoundGT;
break;
case HA_READ_AFTER_KEY: // weird
p.bound_type= NdbIndexScanOperation::BoundGE;
break;
default:
break;
// descending strangely sets no end key
}
}
if (p.bound_type == -1)
{
DBUG_PRINT("error", ("key %d unknown flag %d", j, p.key->flag));
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
DBUG_ASSERT(FALSE);
// Stop setting bounds but continue with what we have
op->end_of_bound(range_no);
DBUG_RETURN(0);
}
}
}
// Seen with e.g. b = 1 and c > 1
if (part[0].bound_type == NdbIndexScanOperation::BoundLE &&
part[1].bound_type == NdbIndexScanOperation::BoundGE &&
memcmp(part[0].part_ptr, part[1].part_ptr, part_store_len) == 0)
{
DBUG_PRINT("info", ("replace LE/GE pair by EQ"));
part[0].bound_type= NdbIndexScanOperation::BoundEQ;
part[1].bound_type= -1;
}
// Not seen but was in previous version
if (part[0].bound_type == NdbIndexScanOperation::BoundEQ &&
part[1].bound_type == NdbIndexScanOperation::BoundGE &&
memcmp(part[0].part_ptr, part[1].part_ptr, part_store_len) == 0)
{
DBUG_PRINT("info", ("remove GE from EQ/GE pair"));
part[1].bound_type= -1;
}
for (j= 0; j <= 1; j++)
{
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
struct part_st &p= part[j];
// Set bound if not done with this key
if (p.key != NULL)
{
DBUG_PRINT("info", ("key %d:%d offset=%d length=%d last=%d bound=%d",
j, i, tot_len, part_len, p.part_last, p.bound_type));
DBUG_DUMP("info", (const char*)p.part_ptr, part_store_len);
// Set bound if not cancelled via type -1
if (p.bound_type != -1)
{
const char* ptr= p.bound_ptr;
char buf[256];
shrink_varchar(field, ptr, buf);
if (op->setBound(i, p.bound_type, ptr))
ERR_RETURN(op->getNdbError());
}
}
}
tot_len+= part_store_len;
}
op->end_of_bound(range_no);
DBUG_RETURN(0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Start ordered index scan in NDB
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
const key_range *end_key,
2005-07-18 13:31:02 +02:00
bool sorted, bool descending,
byte* buf, part_id_range *part_spec)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int res;
bool restart;
NdbTransaction *trans= m_active_trans;
NdbIndexScanOperation *op;
DBUG_ENTER("ha_ndbcluster::ordered_index_scan");
DBUG_PRINT("enter", ("index: %u, sorted: %d, descending: %d",
active_index, sorted, descending));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("Starting new ordered scan on %s", m_tabname));
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= FALSE;
2004-07-22 12:38:09 +02:00
// Check that sorted seems to be initialised
DBUG_ASSERT(sorted == 0 || sorted == 1);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (m_active_cursor == 0)
{
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
restart= FALSE;
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
if (!(op= trans->getNdbIndexScanOperation((NDBINDEX *)
m_index[active_index].index,
(const NDBTAB *) m_table)) ||
op->readTuples(lm, 0, parallelism, sorted, descending))
ERR_RETURN(trans->getNdbError());
2005-07-18 13:31:02 +02:00
if (m_use_partition_function && part_spec != NULL &&
part_spec->start_part == part_spec->end_part)
op->setPartitionId(part_spec->start_part);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
m_active_cursor= op;
} else {
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
restart= TRUE;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
op= (NdbIndexScanOperation*)m_active_cursor;
2005-07-18 13:31:02 +02:00
if (m_use_partition_function && part_spec != NULL &&
part_spec->start_part == part_spec->end_part)
op->setPartitionId(part_spec->start_part);
DBUG_ASSERT(op->getSorted() == sorted);
DBUG_ASSERT(op->getLockMode() ==
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type));
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (op->reset_bounds(m_force_send))
DBUG_RETURN(ndb_err(m_active_trans));
}
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
const key_range *keys[2]= { start_key, end_key };
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
res= set_bounds(op, active_index, false, keys);
if (res)
DBUG_RETURN(res);
}
if (!restart && generate_scan_filter(m_cond_stack, op))
DBUG_RETURN(ndb_err(trans));
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
if (!restart && (res= define_read_attrs(buf, op)))
{
DBUG_RETURN(res);
}
if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans));
DBUG_RETURN(next_result(buf));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Start full table scan in NDB
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
int ha_ndbcluster::full_table_scan(byte *buf)
{
int res;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbScanOperation *op;
NdbTransaction *trans= m_active_trans;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("full_table_scan");
DBUG_PRINT("enter", ("Starting new scan on %s", m_tabname));
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= FALSE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
if (!(op=trans->getNdbScanOperation((const NDBTAB *) m_table)) ||
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
op->readTuples(lm, 0, parallelism))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(trans->getNdbError());
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
m_active_cursor= op;
if (generate_scan_filter(m_cond_stack, op))
DBUG_RETURN(ndb_err(trans));
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if ((res= define_read_attrs(buf, op)))
DBUG_RETURN(res);
if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans));
DBUG_PRINT("exit", ("Scan started successfully"));
DBUG_RETURN(next_result(buf));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Insert one record into NDB
*/
int ha_ndbcluster::write_row(byte *record)
{
2004-08-11 15:06:17 +02:00
bool has_auto_increment;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
uint i;
NdbTransaction *trans= m_active_trans;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbOperation *op;
int res;
THD *thd= current_thd;
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= TRUE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("write_row");
if (!m_use_write && m_ignore_dup_key && table->s->primary_key != MAX_KEY)
{
int peek_res= peek_row(record);
if (!peek_res)
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
m_dupkey= table->s->primary_key;
DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY);
}
if (peek_res != HA_ERR_KEY_NOT_FOUND)
DBUG_RETURN(peek_res);
}
statistic_increment(thd->status_var.ha_write_count, &LOCK_status);
2004-10-04 00:27:04 +02:00
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
has_auto_increment= (table->next_number_field && record == table->record[0]);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(trans->getNdbError());
res= (m_use_write) ? op->writeTuple() :op->insertTuple();
if (res != 0)
ERR_RETURN(trans->getNdbError());
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
{
uint32 part_id;
int error;
if ((error= m_part_info->get_partition_id(m_part_info, &part_id)))
{
DBUG_RETURN(error);
}
op->setPartitionId(part_id);
}
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->primary_key == MAX_KEY)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
// Table has hidden primary key
Ndb *ndb= get_ndb();
Uint64 auto_value= NDB_FAILED_AUTO_INCREMENT;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
auto_value= ndb->getAutoIncrementValue((const NDBTAB *) m_table);
} while (auto_value == NDB_FAILED_AUTO_INCREMENT &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (auto_value == NDB_FAILED_AUTO_INCREMENT)
ERR_RETURN(ndb->getNdbError());
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(op->getNdbError());
}
else
{
int res;
2004-08-13 13:51:18 +02:00
if (has_auto_increment)
{
2005-04-08 12:34:52 +02:00
THD *thd= table->in_use;
m_skip_auto_increment= FALSE;
2004-08-13 13:51:18 +02:00
update_auto_increment();
2005-04-08 12:34:52 +02:00
/* Ensure that handler is always called for auto_increment values */
thd->next_insert_id= 0;
m_skip_auto_increment= !auto_increment_column_changed;
}
2004-08-13 13:51:18 +02:00
if ((res= set_primary_key_from_record(op, record)))
return res;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
// Set non-key attribute(s)
bool set_blob_value= FALSE;
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
for (i= 0; i < table->s->fields; i++)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Field *field= table->field[i];
if (!(field->flags & PRI_KEY_FLAG) &&
(ha_get_bit_in_write_set(i + 1) || !m_use_write) &&
set_ndb_value(op, field, i, record-table->record[0], &set_blob_value))
2004-08-13 13:51:18 +02:00
{
m_skip_auto_increment= TRUE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(op->getNdbError());
2004-08-13 13:51:18 +02:00
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
m_rows_changed++;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Execute write operation
NOTE When doing inserts with many values in
each INSERT statement it should not be necessary
to NoCommit the transaction between each row.
Find out how this is detected!
*/
m_rows_inserted++;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
no_uncommitted_rows_update(1);
m_bulk_insert_not_flushed= TRUE;
if ((m_rows_to_insert == (ha_rows) 1) ||
((m_rows_inserted % m_bulk_insert_rows) == 0) ||
m_primary_key_update ||
set_blob_value)
{
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d",
(int)m_rows_inserted, (int)m_bulk_insert_rows));
m_bulk_insert_not_flushed= FALSE;
if (m_transaction_on)
2004-08-13 13:51:18 +02:00
{
2004-09-17 16:58:08 +02:00
if (execute_no_commit(this,trans) != 0)
{
m_skip_auto_increment= TRUE;
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
}
else
2004-08-13 13:51:18 +02:00
{
if (execute_commit(this,trans) != 0)
{
m_skip_auto_increment= TRUE;
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (trans->restart() != 0)
{
DBUG_ASSERT(0);
DBUG_RETURN(-1);
}
2004-08-13 13:51:18 +02:00
}
}
if ((has_auto_increment) && (m_skip_auto_increment))
2004-08-10 14:38:24 +02:00
{
Ndb *ndb= get_ndb();
Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
2004-08-10 14:38:24 +02:00
DBUG_PRINT("info",
("Trying to set next auto increment value to %lu",
(ulong) next_val));
if (ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE))
2004-08-10 14:38:24 +02:00
DBUG_PRINT("info",
("Setting next auto increment value to %u", next_val));
}
m_skip_auto_increment= TRUE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
/* Compare if a key in a row has changed */
int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row,
const byte * new_row)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
KEY_PART_INFO *key_part=table->key_info[keynr].key_part;
KEY_PART_INFO *end=key_part+table->key_info[keynr].key_parts;
for (; key_part != end ; key_part++)
{
if (key_part->null_bit)
{
if ((old_row[key_part->null_offset] & key_part->null_bit) !=
(new_row[key_part->null_offset] & key_part->null_bit))
return 1;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
Add support for up to VARCHAR (size up to 65535) Renamed HA_VAR_LENGTH to HA_VAR_LENGTH_PART Renamed in all files FIELD_TYPE_STRING and FIELD_TYPE_VAR_STRING to MYSQL_TYPE_STRING and MYSQL_TYPE_VAR_STRING to make it easy to catch all possible errors Added support for VARCHAR KEYS to heap Removed support for ISAM Now only long VARCHAR columns are changed to TEXT on demand (not CHAR) Internal temporary files can now use fixed length tables if the used VARCHAR columns are short BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e: Delete: sql/ha_isam.cc BitKeeper/deleted/.del-_cache.c~b5d80b5c3ae233b1: Delete: isam/_cache.c BitKeeper/deleted/.del-_dbug.c~88d7964ae5e3c9bd: Delete: isam/_dbug.c BitKeeper/deleted/.del-_dynrec.c~48dd758f5a5450df: Delete: isam/_dynrec.c BitKeeper/deleted/.del-_key.c~ce62d47a6c681084: Delete: isam/_key.c BitKeeper/deleted/.del-_locking.c~dea4cdc6ea425c67: Delete: isam/_locking.c BitKeeper/deleted/.del-_packrec.c~47ae1b16c007e9be: Delete: isam/_packrec.c BitKeeper/deleted/.del-_page.c~148b1a613d052ee8: Delete: isam/_page.c BitKeeper/deleted/.del-_search.c~f509292aa1ff18ff: Delete: isam/_search.c BitKeeper/deleted/.del-_statrec.c~58d9263b3475d58b: Delete: isam/_statrec.c BitKeeper/deleted/.del-changed.c~d075de80a314b02d: Delete: isam/changed.c BitKeeper/deleted/.del-close.c~fd62629496ee5bcc: Delete: isam/close.c BitKeeper/deleted/.del-create.c~96cecc433c0c2242: Delete: isam/create.c BitKeeper/deleted/.del-delete.c~65ee8daaa75a14b6: Delete: isam/delete.c BitKeeper/deleted/.del-extra.c~706f29d72beb2565: Delete: isam/extra.c BitKeeper/deleted/.del-info.c~96cfb747af8da0d: Delete: isam/info.c BitKeeper/deleted/.del-isamchk.c~c0f59c2687d2248f: Delete: isam/isamchk.c BitKeeper/deleted/.del-isamlog.c~85b6b31c6e2b8519: Delete: isam/isamlog.c BitKeeper/deleted/.del-log.c~55a973013d55cade: Delete: isam/log.c BitKeeper/deleted/.del-open.c~95b3b75042fae00a: Delete: isam/open.c BitKeeper/deleted/.del-pack_isam.c~43801f0df7504834: Delete: isam/pack_isam.c BitKeeper/deleted/.del-panic.c~f7fd71605324f8f3: Delete: isam/panic.c BitKeeper/deleted/.del-range.c~142f1f8ac4948082: Delete: isam/range.c BitKeeper/deleted/.del-rfirst.c~66f494291dc005d3: Delete: isam/rfirst.c BitKeeper/deleted/.del-rkey.c~cc54c6498352f999: Delete: isam/rkey.c BitKeeper/deleted/.del-rlast.c~d1fe1866139e9866: Delete: isam/rlast.c BitKeeper/deleted/.del-rnext.c~b308eaa1e11ea7de: Delete: isam/rnext.c BitKeeper/deleted/.del-rprev.c~b359f71fdea4bbce: Delete: isam/rprev.c BitKeeper/deleted/.del-rrnd.c~7fcfcce88d4a5200: Delete: isam/rrnd.c BitKeeper/deleted/.del-rsame.c~75a62d5548103a15: Delete: isam/rsame.c BitKeeper/deleted/.del-rsamepos.c~5b5652dd2cda6d5d: Delete: isam/rsamepos.c BitKeeper/deleted/.del-sort.c~e2e56b5a37ce86f4: Delete: isam/sort.c BitKeeper/deleted/.del-static.c~3a1354b84f4a9cc7: Delete: isam/static.c BitKeeper/deleted/.del-test1.c~64d52e9412d457ed: Delete: isam/test1.c BitKeeper/deleted/.del-test2.c~2f9a632cab572958: Delete: isam/test2.c BitKeeper/deleted/.del-test3.c~e8a7a4afe8a087: Delete: isam/test3.c BitKeeper/deleted/.del-isamdef.h~ac8d49e7e2201c66: Delete: isam/isamdef.h BitKeeper/deleted/.del-update.c~670264f51dc44934: Delete: isam/update.c BitKeeper/deleted/.del-write.c~8f1918b1f6770e54: Delete: isam/write.c BitKeeper/deleted/.del-Makefile.am~6cfa0db5e7778d09: Delete: isam/Makefile.am BitKeeper/deleted/.del-make-ccc~3ee55391eda0b0ab: Delete: isam/make-ccc BitKeeper/deleted/.del-ChangeLog~208984fb7a51e568: Delete: isam/ChangeLog BitKeeper/deleted/.del-test_all.res~c2aafb49a3a77db7: Delete: isam/test_all.res BitKeeper/deleted/.del-test_all~93c701e44a9c5b65: Delete: isam/test_all BitKeeper/deleted/.del-.cvsignore~54f6f0f2d5012561: Delete: isam/.cvsignore BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e: Delete: sql/ha_isammrg.cc BitKeeper/deleted/.del-ha_isam.h~bf53d533be3d3927: Delete: sql/ha_isam.h BitKeeper/deleted/.del-ha_isammrg.h~66fd2e5bfe7207dc: Delete: sql/ha_isammrg.h acinclude.m4: Remove ISAM client/mysqldump.c: FIELD_TYPE -> MYSQL_TYPE client/mysqltest.c: Add missing DBUG_RETURN configure.in: Remove ISAM heap/heapdef.h: Add support for VARCHAR heap/hp_create.c: Add support for VARCHAR heap/hp_delete.c: Add support for VARCHAR heap/hp_hash.c: Add support for VARCHAR (VARCHAR keys was not supported before) heap/hp_rkey.c: Add support for VARCHAR heap/hp_update.c: Add support for VARCHAR heap/hp_write.c: Add support for VARCHAR (Added flag SEARCH_UPDATE to mark that this is an update) include/decimal.h: Remove not needed my_global.h include/m_ctype.h: Add support for VARCHAR include/my_base.h: Add support for VARCHAR include/my_handler.h: Moved general purpose macro from MyISAM code include/mysql_com.h: Add support for VARCHAR libmysql/libmysql.c: Add support for VARCHAR libmysqld/Makefile.am: Removed ISAM myisam/ft_static.c: Add support for VARCHAR myisam/ft_test1.c: Add support for VARCHAR myisam/ft_update.c: Add support for VARCHAR myisam/mi_check.c: Add support for VARCHAR myisam/mi_create.c: Add support for VARCHAR - VARCHAR key segments are marked with HA_VAR_LENGTH_PART myisam/mi_key.c: Add support for VARCHAR Fixed bug in old VARCHAR code when reading index-only myisam/mi_range.c: Fixed comment style myisam/mi_rnext_same.c: Handle case where equal keys can be of different length myisam/mi_search.c: Add support for VARCHAR myisam/mi_test1.c: Add support for VARCHAR myisam/mi_unique.c: Add support for VARCHAR (Some new code to handle keys that are equal but have different lengths) myisam/mi_write.c: Fixed comment myisam/myisamchk.c: Better infotext if wrong type mysql-test/r/bdb.result: Updated old result and new results for VARCHAR mysql-test/r/create.result: Updated old result and new results for VARCHAR mysql-test/r/ctype_tis620.result: Updated old result and new results for VARCHAR (Old code sorted tis620 wrong) mysql-test/r/ctype_ucs.result: Updated old result and new results for VARCHAR mysql-test/r/endspace.result: Updated old result and new results for VARCHAR mysql-test/r/func_like.result: Updated old result and new results for VARCHAR mysql-test/r/heap.result: Updated old result and new results for VARCHAR mysql-test/r/innodb.result: Updated old result. This will change a bit when also InnoDB supports VARCHAR mysql-test/r/merge.result: Updated old result and new results for VARCHAR mysql-test/r/myisam.result: Updated old result and new results for VARCHAR mysql-test/r/mysqldump.result: Updated old result and new results for VARCHAR mysql-test/r/order_by.result: Updated old result and new results for VARCHAR (Key length is different for VARCHAR) mysql-test/r/ps.result: Updated old result and new results for VARCHAR mysql-test/r/ps_1general.result: Updated results for new .frm version Don't print seconds in show full process list as this may change mysql-test/r/ps_2myisam.result: Updated old result and new results for VARCHAR mysql-test/r/ps_3innodb.result: Updated old result and new results for VARCHAR mysql-test/r/ps_4heap.result: Updated old result and new results for VARCHAR mysql-test/r/ps_5merge.result: Updated old result and new results for VARCHAR mysql-test/r/ps_6bdb.result: Updated old result and new results for VARCHAR mysql-test/r/select.result.es: Updated results by hand mysql-test/r/select.result: Updated old result and new results for VARCHAR mysql-test/r/select_found.result: Updated old result and new results for VARCHAR mysql-test/r/show_check.result: Updated old result and new results for VARCHAR mysql-test/r/strict.result: Updated old result and new results for VARCHAR mysql-test/r/subselect.result: Updated old result and new results for VARCHAR mysql-test/r/system_mysql_db.result: Updated old result and new results for VARCHAR mysql-test/r/type_blob.result: Updated old result and new results for VARCHAR mysql-test/r/type_ranges.result: Updated old result and new results for VARCHAR mysql-test/r/type_ranges.result.es: Updated some results by hand mysql-test/t/bdb.test: Test VARCHAR mysql-test/t/ctype_ucs.test: Some fixes related to VARCHAR mysql-test/t/endspace.test: Fixes to make it easier to compare columns with end space mysql-test/t/heap.test: Test VARCHAR mysql-test/t/innodb.test: Prepare for testing VARCHAR mysql-test/t/myisam.test: Test VARCHAR mysql-test/t/ps_1general.test: Don't show seconds for show processlist mysql-test/t/ps_4heap.test: Update for VARCHAR mysql-test/t/strict.test: Fix test for VARCHAR mysql-test/t/type_blob.test: Update test for VARCHAR Note that now you can't store 'a' and 'a ' in an unique varchar/text index if the column is not binary mysys/my_handler.c: Add support for VARCHAR ndb/src/common/util/NdbSqlUtil.cpp: Fix for usage of strnncollsp scripts/mysql_fix_privilege_tables.sh: Simple fix so that my_print_defaults works sql/Makefile.am: Remove ISAM sql/field.cc: Add support for VARCHAR Fixed the keys for blob's are compared with strnncollsp Ensure that old tables from MySQL 4.0 works as they did before. (Old VARCHAR will be converted to new VARCHAR on ALTER TABLE) sql/field.h: Add support for VARCHAR sql/field_conv.cc: Change FIELD_TYPE_VAR_STRING -> MYSQL_TYPE_VARCHAR Added usage of HA_KEY_BLOB_LENGTH sql/ha_berkeley.cc: Add support for VARCHAR Added usage of table->insert_or_update if we would ever want to know in key_cmp if we are changing keys sql/ha_heap.cc: Add support for VARCHAR sql/ha_innodb.cc: Changed MYSQL_TYPE_VAR_STRING to MYSQL_TYPE_VARCHAR. Waiting for Heikki to add full VARCHAR support sql/ha_innodb.h: InnoDB doesn't support full VARCHAR yet sql/ha_myisam.cc: Add support for VARCHAR sql/ha_ndbcluster.cc: Add support for VARCHAR sql/handler.h: Added HA_NO_VARCHAR for table handler that doesn't support VARCHAR. In this case MySQL will create a normal CHAR instead sql/item.cc: Fixed access of already freed memory Added support of VARCHAR - varchar length is now checked in mysql_prepare sql/item_cmpfunc.cc: Added new parameter to strncollsp sql/item_sum.cc: Added new parameter to strncollsp FIELD_TYPE -> MYSQL_TYPE sql/key.cc: Add support for VARCHAR sql/opt_range.cc: Remove character set parameter from set_key_image() sql/opt_sum.cc: Remove character set parameter from set_key_image() sql/protocol.cc: Return MYSQL_TYPE_VAR_STRING instead of MYSQL_TYPE_VARCHAR to clients (to not cause compatiblity problems) sql/sql_acl.cc: Change key handling code so that we can use CHAR or VARCHAR for the user table columns sql/sql_base.cc: Remove old, not used code sql/sql_help.cc: Remove charset from get_key_image sql/sql_parse.cc: Ensure that OPTION_TABLE_LOCK is cleared ASAP; This fixed a problem in BDB transaction code when one used LOCK TABLES on a BDB table Added support for VARCHAR Moved field length checking and VARCHAR -> TEXT convert to mysql_prepare (as we need the know the character set for the column) sql/sql_select.cc: Added support of VARCHAR Added heuristic to use fixed size rows for tmp tables if we are using only a few short VARCHAR's sql/sql_string.cc: Added extra argument to strnncollsp sql/sql_table.cc: Add support for VARCHAR Automaticly convert (with warning) big VARCHAR (but not CHAR) to TEXT If handler doesn't support VARCHAR convert VARCHAR to CHAR sql/sql_update.cc: Fixed compiler warning sql/sql_yacc.yy: Add support for VARCHAR sql/strfunc.cc: Fixed valgrind warning sql/structs.h: Added 'table' to KEY structure to make life easier for some handler functions sql/table.cc: Add support for VARCHAR - New .frm version - FIELD_TYPE -> MYSQL_TYPE sql/table.h: Added insert_or_update; A bool flag a handler can set/reset if needed (for handler internal usage) sql/unireg.h: Add support for VARCHAR strings/ctype-big5.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-bin.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not strings/ctype-czech.c: Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-gbk.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-latin1.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not strings/ctype-mb.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-simple.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-sjis.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-tis620.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-uca.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not strings/ctype-ucs2.c: Changed my_like_range... to correctly calculate min_length & max_length strings/ctype-utf8.c: Added new argument to strnncollsp() to allow one to define if end space are significant or not strings/ctype-win1250ch.c: Changed my_like_range... to correctly calculate min_length & max_length strings/decimal.c: Fixed include files usage Fixed some compiler warnings tests/client_test.c: Ensure tests works with VARCHAR
2004-12-06 01:00:37 +01:00
if (key_part->key_part_flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
if (key_part->field->cmp_binary((char*) (old_row + key_part->offset),
(char*) (new_row + key_part->offset),
(ulong) key_part->length))
return 1;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
else
{
if (memcmp(old_row+key_part->offset, new_row+key_part->offset,
key_part->length))
return 1;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
}
return 0;
}
/*
Update one record in NDB using primary key
*/
int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
{
THD *thd= current_thd;
NdbTransaction *trans= m_active_trans;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
NdbScanOperation* cursor= m_active_cursor;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbOperation *op;
uint i;
2005-07-18 13:31:02 +02:00
uint32 old_part_id= 0, new_part_id= 0;
int error;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("update_row");
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= TRUE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
statistic_increment(thd->status_var.ha_update_count, &LOCK_status);
2004-10-04 00:27:04 +02:00
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
{
2004-10-04 00:27:04 +02:00
table->timestamp_field->set_time();
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
ha_set_bit_in_write_set(table->timestamp_field->fieldnr);
}
2004-10-04 00:27:04 +02:00
2005-07-18 13:31:02 +02:00
if (m_use_partition_function &&
(error= get_parts_for_update(old_data, new_data, table->record[0],
m_part_info, &old_part_id, &new_part_id)))
{
DBUG_RETURN(error);
}
/* Check for update of primary key for special handling */
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if ((table->s->primary_key != MAX_KEY) &&
2005-07-18 13:31:02 +02:00
(key_cmp(table->s->primary_key, old_data, new_data)) ||
(old_part_id != new_part_id))
{
int read_res, insert_res, delete_res, undo_res;
DBUG_PRINT("info", ("primary key update, doing pk read+delete+insert"));
// Get all old fields, since we optimize away fields not in query
2005-07-18 13:31:02 +02:00
read_res= complemented_pk_read(old_data, new_data, old_part_id);
if (read_res)
{
DBUG_PRINT("info", ("pk read failed"));
DBUG_RETURN(read_res);
}
// Delete old row
m_primary_key_update= TRUE;
delete_res= delete_row(old_data);
m_primary_key_update= FALSE;
if (delete_res)
{
DBUG_PRINT("info", ("delete failed"));
DBUG_RETURN(delete_res);
}
// Insert new row
DBUG_PRINT("info", ("delete succeded"));
m_primary_key_update= TRUE;
insert_res= write_row(new_data);
m_primary_key_update= FALSE;
if (insert_res)
{
DBUG_PRINT("info", ("insert failed"));
if (trans->commitStatus() == NdbConnection::Started)
{
// Undo delete_row(old_data)
m_primary_key_update= TRUE;
undo_res= write_row((byte *)old_data);
if (undo_res)
push_warning(current_thd,
MYSQL_ERROR::WARN_LEVEL_WARN,
undo_res,
"NDB failed undoing delete at primary key update");
m_primary_key_update= FALSE;
}
DBUG_RETURN(insert_res);
}
DBUG_PRINT("info", ("delete+insert succeeded"));
DBUG_RETURN(0);
}
if (cursor)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
/*
We are scanning records and want to update the record
that was just found, call updateTuple on the cursor
to take over the lock to a new update operation
And thus setting the primary key of the record from
the active record in cursor
*/
DBUG_PRINT("info", ("Calling updateTuple on cursor"));
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
if (!(op= cursor->updateCurrentTuple()))
ERR_RETURN(trans->getNdbError());
m_ops_pending++;
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
if (uses_blob_value())
m_blobs_pending= TRUE;
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
cursor->setPartitionId(new_part_id);
}
else
{
if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)) ||
op->updateTuple() != 0)
ERR_RETURN(trans->getNdbError());
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
op->setPartitionId(new_part_id);
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->primary_key == MAX_KEY)
{
// This table has no primary key, use "hidden" primary key
DBUG_PRINT("info", ("Using hidden key"));
// Require that the PK for this record has previously been
// read into m_value
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
uint no_fields= table->s->fields;
const NdbRecAttr* rec= m_value[no_fields].rec;
DBUG_ASSERT(rec);
DBUG_DUMP("key", (char*)rec->aRef(), NDB_HIDDEN_PRIMARY_KEY_LENGTH);
if (set_hidden_key(op, no_fields, rec->aRef()))
ERR_RETURN(op->getNdbError());
}
else
{
int res;
if ((res= set_primary_key_from_record(op, old_data)))
DBUG_RETURN(res);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
m_rows_changed++;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Set non-key attribute(s)
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
for (i= 0; i < table->s->fields; i++)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Field *field= table->field[i];
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
if (ha_get_bit_in_write_set(i+1) &&
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
(!(field->flags & PRI_KEY_FLAG)) &&
set_ndb_value(op, field, i, new_data - table->record[0]))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(op->getNdbError());
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Execute update operation
2004-09-17 16:58:08 +02:00
if (!cursor && execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(ndb_err(trans));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
/*
Delete one record from NDB, using primary key
*/
int ha_ndbcluster::delete_row(const byte *record)
{
THD *thd= current_thd;
NdbTransaction *trans= m_active_trans;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
NdbScanOperation* cursor= m_active_cursor;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbOperation *op;
2005-07-18 13:31:02 +02:00
uint32 part_id;
int error;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("delete_row");
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= TRUE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
statistic_increment(thd->status_var.ha_delete_count,&LOCK_status);
m_rows_changed++;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
2005-07-18 13:31:02 +02:00
if (m_use_partition_function &&
(error= get_part_for_delete(record, table->record[0], m_part_info,
&part_id)))
{
DBUG_RETURN(error);
}
if (cursor)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
/*
We are scanning records and want to delete the record
that was just found, call deleteTuple on the cursor
to take over the lock to a new delete operation
And thus setting the primary key of the record from
the active record in cursor
*/
DBUG_PRINT("info", ("Calling deleteTuple on cursor"));
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
if (cursor->deleteCurrentTuple() != 0)
ERR_RETURN(trans->getNdbError());
m_ops_pending++;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
cursor->setPartitionId(part_id);
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
no_uncommitted_rows_update(-1);
if (!m_primary_key_update)
// If deleting from cursor, NoCommit will be handled in next_result
DBUG_RETURN(0);
}
else
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
if (!(op=trans->getNdbOperation((const NDBTAB *) m_table)) ||
op->deleteTuple() != 0)
ERR_RETURN(trans->getNdbError());
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
op->setPartitionId(part_id);
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
no_uncommitted_rows_update(-1);
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->primary_key == MAX_KEY)
{
// This table has no primary key, use "hidden" primary key
DBUG_PRINT("info", ("Using hidden key"));
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
uint no_fields= table->s->fields;
const NdbRecAttr* rec= m_value[no_fields].rec;
DBUG_ASSERT(rec != NULL);
if (set_hidden_key(op, no_fields, rec->aRef()))
ERR_RETURN(op->getNdbError());
}
else
{
int res;
if ((res= set_primary_key_from_record(op, record)))
return res;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Execute delete operation
2004-09-17 16:58:08 +02:00
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(ndb_err(trans));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Unpack a record read from NDB
SYNOPSIS
unpack_record()
buf Buffer to store read row
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NOTE
The data for each row is read directly into the
destination buffer. This function is primarily
called in order to check if any fields should be
set to null.
*/
static void ndb_unpack_record(TABLE *table, NdbValue *value,
MY_BITMAP *defined, byte *buf)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Field **p_field= table->field, *field= *p_field;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
uint row_offset= (uint) (buf - table->record[0]);
DBUG_ENTER("ndb_unpack_record");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Set null flag(s)
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
bzero(buf, table->s->null_bytes);
for ( ; field;
p_field++, value++, field= *p_field)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
2004-07-22 12:38:09 +02:00
if ((*value).ptr)
{
if (!(field->flags & BLOB_FLAG))
2004-07-22 12:38:09 +02:00
{
int is_null= (*value).rec->isNULL();
if (is_null)
2004-12-23 15:28:41 +01:00
{
if (is_null > 0)
{
DBUG_PRINT("info",("[%u] NULL",
(*value).rec->getColumn()->getColumnNo()));
field->set_null(row_offset);
}
else
{
DBUG_PRINT("info",("[%u] UNDEFINED",
(*value).rec->getColumn()->getColumnNo()));
bitmap_clear_bit(defined,
(*value).rec->getColumn()->getColumnNo());
}
}
else if (field->type() == MYSQL_TYPE_BIT)
{
byte *save_field_ptr= field->ptr;
field->ptr= save_field_ptr + row_offset;
if (field->pack_length() < 5)
2004-12-23 15:28:41 +01:00
{
DBUG_PRINT("info", ("bit field H'%.8X",
(*value).rec->u_32_value()));
((Field_bit*) field)->store((longlong)
(*value).rec->u_32_value(), FALSE);
2004-12-23 15:28:41 +01:00
}
else
{
DBUG_PRINT("info", ("bit field H'%.8X%.8X",
*(Uint32*) (*value).rec->aRef(),
*((Uint32*) (*value).rec->aRef()+1)));
((Field_bit*) field)->store((longlong)
(*value).rec->u_64_value(),TRUE);
Added option --valgrind-mysqltest to mysql-test-run Added flag to Field::store(longlong) to specify if value is unsigned. This fixes bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0) Fixed warning from valgrind in CREATE ... SELECT Fixed double free of mysql.options if reconnect failed mysql-test/mysql-test-run.sh: Added option --valgrind-mysqltest to allow one to run mysqltest with valgrind mysql-test/r/bigint.result: Update results after fix for Field::store(longlong) mysql-test/r/range.result: Update results after fix for Field::store(longlong) mysql-test/r/strict.result: Update results after fix for Field::store(longlong) (This fixes some wrong results when storing things into bigint columns) mysql-test/r/type_ranges.result: Update results after fix for Field::store(longlong) mysql-test/t/bigint.test: Added testing for #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0) mysql-test/t/innodb.test: Removed comments affected by this bug fix mysql-test/t/mysqldump.test: Fixed result to not depend on existing config files mysql-test/t/range.test: 0xff numbers are now unsigned mysql-test/t/strict.test: Added errors for things that previously (wrongly) succeeded sql-common/client.c: Fixed double free of mysql.options if reconnect failed sql/field.cc: Added flag to Field::store(longlong) to specify if value is unsigned sql/field.h: Added flag to Field::store(longlong) to specify if value is unsigned sql/field_conv.cc: Fixed calls to Field::store(longlong,flag) sql/ha_ndbcluster.cc: Fixed calls to Field::store(longlong,flag) sql/handler.cc: Fixed calls to Field::store(longlong,flag) sql/item.cc: Fixed calls to Field::store(longlong,flag) sql/item_sum.cc: Fixed calls to Field::store(longlong,flag) sql/sp.cc: Fixed calls to Field::store(longlong,flag) sql/sql_acl.cc: Fixed calls to Field::store(longlong,flag) sql/sql_help.cc: Fixed calls to Field::store(longlong,flag) sql/sql_show.cc: Fixed calls to Field::store(longlong,flag) sql/sql_table.cc: Fixed varning from valgrind sql/sql_udf.cc: Fixed calls to Field::store(longlong,flag) sql/tztime.cc: Fixed calls to Field::store(longlong,flag) sql/unireg.cc: Fixed calls to Field::store(longlong,flag)
2005-09-14 00:41:44 +02:00
}
field->ptr= save_field_ptr;
DBUG_PRINT("info",("[%u] SET",
(*value).rec->getColumn()->getColumnNo()));
DBUG_DUMP("info", (const char*) field->ptr, field->field_length);
}
else
{
DBUG_PRINT("info",("[%u] SET",
(*value).rec->getColumn()->getColumnNo()));
DBUG_DUMP("info", (const char*) field->ptr, field->field_length);
2004-12-23 15:28:41 +01:00
}
2004-07-22 12:38:09 +02:00
}
else
{
NdbBlob *ndb_blob= (*value).blob;
bool isNull= TRUE;
#ifndef DBUG_OFF
int ret=
#endif
ndb_blob->getNull(isNull);
2004-07-22 12:38:09 +02:00
DBUG_ASSERT(ret == 0);
if (isNull)
field->set_null(row_offset);
2004-07-22 12:38:09 +02:00
}
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
DBUG_VOID_RETURN;
}
void ha_ndbcluster::unpack_record(byte *buf)
{
ndb_unpack_record(table, m_value, 0, buf);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#ifndef DBUG_OFF
// Read and print all values that was fetched
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->primary_key == MAX_KEY)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
// Table with hidden primary key
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
int hidden_no= table->s->fields;
const NDBTAB *tab= (const NDBTAB *) m_table;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
const NDBCOL *hidden_col= tab->getColumn(hidden_no);
const NdbRecAttr* rec= m_value[hidden_no].rec;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ASSERT(rec);
DBUG_PRINT("hidden", ("%d: %s \"%llu\"", hidden_no,
hidden_col->getName(), rec->u_64_value()));
}
//print_results();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#endif
}
/*
Utility function to print/dump the fetched field
*/
void ha_ndbcluster::print_results()
{
DBUG_ENTER("print_results");
#ifndef DBUG_OFF
if (!_db_on_)
DBUG_VOID_RETURN;
2005-02-11 22:33:52 +01:00
char buf_type[MAX_FIELD_WIDTH], buf_val[MAX_FIELD_WIDTH];
2005-02-11 22:33:52 +01:00
String type(buf_type, sizeof(buf_type), &my_charset_bin);
String val(buf_val, sizeof(buf_val), &my_charset_bin);
for (uint f= 0; f < table->s->fields; f++)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
2005-02-11 22:33:52 +01:00
/* Use DBUG_PRINT since DBUG_FILE cannot be filtered out */
char buf[2000];
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
Field *field;
void* ptr;
2004-07-22 12:38:09 +02:00
NdbValue value;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
buf[0]= 0;
2005-02-11 22:33:52 +01:00
field= table->field[f];
2004-07-22 12:38:09 +02:00
if (!(value= m_value[f]).ptr)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
strmov(buf, "not read");
goto print_value;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
ptr= field->ptr;
2004-07-22 12:38:09 +02:00
if (! (field->flags & BLOB_FLAG))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
2004-07-22 12:38:09 +02:00
if (value.rec->isNULL())
{
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
strmov(buf, "NULL");
goto print_value;
2004-07-22 12:38:09 +02:00
}
type.length(0);
val.length(0);
field->sql_type(type);
field->val_str(&val);
my_snprintf(buf, sizeof(buf), "%s %s", type.c_ptr(), val.c_ptr());
2004-07-22 12:38:09 +02:00
}
else
{
NdbBlob *ndb_blob= value.blob;
bool isNull= TRUE;
2004-07-22 12:38:09 +02:00
ndb_blob->getNull(isNull);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (isNull)
strmov(buf, "NULL");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2005-02-11 22:33:52 +01:00
print_value:
2005-02-11 22:33:52 +01:00
DBUG_PRINT("value", ("%u,%s: %s", f, field->field_name, buf));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
#endif
DBUG_VOID_RETURN;
}
2005-07-18 13:31:02 +02:00
int ha_ndbcluster::index_init(uint index, bool sorted)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_ENTER("ha_ndbcluster::index_init");
2005-07-18 13:31:02 +02:00
DBUG_PRINT("enter", ("index: %u sorted: %d", index, sorted));
active_index= index;
m_sorted= sorted;
DBUG_RETURN(0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::index_end()
{
DBUG_ENTER("ha_ndbcluster::index_end");
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
DBUG_RETURN(close_scan());
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/**
* Check if key contains null
*/
static
int
check_null_in_key(const KEY* key_info, const byte *key, uint key_len)
{
KEY_PART_INFO *curr_part, *end_part;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
const byte* end_ptr= key + key_len;
curr_part= key_info->key_part;
end_part= curr_part + key_info->key_parts;
for (; curr_part != end_part && key < end_ptr; curr_part++)
{
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (curr_part->null_bit && *key)
return 1;
key += curr_part->store_length;
}
return 0;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::index_read(byte *buf,
const byte *key, uint key_len,
enum ha_rkey_function find_flag)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
2005-07-18 13:31:02 +02:00
key_range start_key;
bool descending= FALSE;
DBUG_ENTER("ha_ndbcluster::index_read");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("active_index: %u, key_len: %u, find_flag: %d",
active_index, key_len, find_flag));
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
start_key.key= key;
start_key.length= key_len;
start_key.flag= find_flag;
2005-07-18 13:31:02 +02:00
descending= FALSE;
switch (find_flag) {
case HA_READ_KEY_OR_PREV:
case HA_READ_BEFORE_KEY:
case HA_READ_PREFIX_LAST:
case HA_READ_PREFIX_LAST_OR_PREV:
descending= TRUE;
break;
default:
break;
}
2005-07-18 13:31:02 +02:00
DBUG_RETURN(read_range_first_to_buf(&start_key, 0, descending,
m_sorted, buf));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::index_read_idx(byte *buf, uint index_no,
const byte *key, uint key_len,
enum ha_rkey_function find_flag)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
DBUG_ENTER("ha_ndbcluster::index_read_idx");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("index_no: %u, key_len: %u", index_no, key_len));
2005-07-18 13:31:02 +02:00
index_init(index_no, 0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(index_read(buf, key, key_len, find_flag));
}
int ha_ndbcluster::index_next(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_next");
statistic_increment(current_thd->status_var.ha_read_next_count,
&LOCK_status);
DBUG_RETURN(next_result(buf));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::index_prev(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_prev");
statistic_increment(current_thd->status_var.ha_read_prev_count,
&LOCK_status);
DBUG_RETURN(next_result(buf));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::index_first(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_first");
statistic_increment(current_thd->status_var.ha_read_first_count,
&LOCK_status);
// Start the ordered index scan and fetch the first row
// Only HA_READ_ORDER indexes get called by index_first
2005-07-18 13:31:02 +02:00
DBUG_RETURN(ordered_index_scan(0, 0, TRUE, FALSE, buf, NULL));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::index_last(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_last");
statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
2005-07-18 13:31:02 +02:00
DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::index_read_last(byte * buf, const byte * key, uint key_len)
{
DBUG_ENTER("ha_ndbcluster::index_read_last");
DBUG_RETURN(index_read(buf, key, key_len, HA_READ_PREFIX_LAST));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key,
const key_range *end_key,
2005-07-18 13:31:02 +02:00
bool desc, bool sorted,
byte* buf)
{
2005-07-18 13:31:02 +02:00
part_id_range part_spec;
ndb_index_type type= get_index_type(active_index);
const KEY* key_info= table->key_info+active_index;
int error;
DBUG_ENTER("ha_ndbcluster::read_range_first_to_buf");
2005-07-18 13:31:02 +02:00
DBUG_PRINT("info", ("desc: %d, sorted: %d", desc, sorted));
2005-07-18 13:31:02 +02:00
if (m_use_partition_function)
{
get_partition_set(table, buf, active_index, start_key, &part_spec);
if (part_spec.start_part > part_spec.end_part)
{
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
else if (part_spec.start_part == part_spec.end_part)
{
/*
Only one partition is required to scan, if sorted is required we
don't need it any more since output from one ordered partitioned
index is always sorted.
*/
sorted= FALSE;
}
}
m_write_op= FALSE;
switch (type){
case PRIMARY_KEY_ORDERED_INDEX:
case PRIMARY_KEY_INDEX:
if (start_key &&
start_key->length == key_info->key_length &&
start_key->flag == HA_READ_KEY_EXACT)
{
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (m_active_cursor && (error= close_scan()))
DBUG_RETURN(error);
2005-07-18 13:31:02 +02:00
DBUG_RETURN(pk_read(start_key->key, start_key->length, buf,
part_spec.start_part));
}
break;
case UNIQUE_ORDERED_INDEX:
case UNIQUE_INDEX:
if (start_key && start_key->length == key_info->key_length &&
start_key->flag == HA_READ_KEY_EXACT &&
!check_null_in_key(key_info, start_key->key, start_key->length))
{
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (m_active_cursor && (error= close_scan()))
DBUG_RETURN(error);
2005-07-18 13:31:02 +02:00
DBUG_RETURN(unique_index_read(start_key->key, start_key->length, buf));
}
break;
default:
break;
}
// Start the ordered index scan and fetch the first row
2005-07-18 13:31:02 +02:00
DBUG_RETURN(ordered_index_scan(start_key, end_key, sorted, desc, buf,
&part_spec));
}
int ha_ndbcluster::read_range_first(const key_range *start_key,
const key_range *end_key,
bool eq_r, bool sorted)
{
byte* buf= table->record[0];
DBUG_ENTER("ha_ndbcluster::read_range_first");
2005-07-18 13:31:02 +02:00
DBUG_RETURN(read_range_first_to_buf(start_key, end_key, FALSE,
sorted, buf));
}
int ha_ndbcluster::read_range_next()
{
DBUG_ENTER("ha_ndbcluster::read_range_next");
DBUG_RETURN(next_result(table->record[0]));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::rnd_init(bool scan)
{
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
NdbScanOperation *cursor= m_active_cursor;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("rnd_init");
DBUG_PRINT("enter", ("scan: %d", scan));
// Check if scan is to be restarted
2004-08-24 23:13:32 +02:00
if (cursor)
{
if (!scan)
DBUG_RETURN(1);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (cursor->restart(m_force_send) != 0)
{
DBUG_ASSERT(0);
DBUG_RETURN(-1);
}
2004-08-24 23:13:32 +02:00
}
2005-07-18 13:31:02 +02:00
index_init(table->s->primary_key, 0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
int ha_ndbcluster::close_scan()
{
NdbTransaction *trans= m_active_trans;
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
DBUG_ENTER("close_scan");
m_multi_cursor= 0;
if (!m_active_cursor && !m_multi_cursor)
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
DBUG_RETURN(1);
NdbScanOperation *cursor= m_active_cursor ? m_active_cursor : m_multi_cursor;
if (m_ops_pending)
{
/*
Take over any pending transactions to the
deleteing/updating transaction before closing the scan
*/
DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
2004-09-17 16:58:08 +02:00
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
m_ops_pending= 0;
}
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
cursor->close(m_force_send, TRUE);
m_active_cursor= m_multi_cursor= NULL;
DBUG_RETURN(0);
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::rnd_end()
{
DBUG_ENTER("rnd_end");
WL# 1729 Handler: error text for NDB errors - Close an open scan if index_read is called without closing the previous one. - Removed some errors that occured during previous merge include/mysqld_error.h: Added two new error messages for NDB sql/ha_ndbcluster.cc: Added more error code mappings, from NDB code to MySQL Added function to print out the error message when an NDB error occurs. Added two new error codes, which will represent either a permanent or temporary NDB error. Modev get_ndb_lock_type from class to local function Removed some merge errors New function close_scan, to close an open scan. sql/ha_ndbcluster.h: Added print_error function, overrides handler::print_error Added close_scan Moved get_ndb_lock_type from class to local function sql/share/czech/errmsg.txt: Added two new error messages for NDB sql/share/danish/errmsg.txt: Added two new error messages for NDB sql/share/dutch/errmsg.txt: Added two new error messages for NDB sql/share/english/errmsg.txt: Added two new error messages for NDB sql/share/estonian/errmsg.txt: Added two new error messages for NDB sql/share/french/errmsg.txt: Added two new error messages for NDB sql/share/german/errmsg.txt: Added two new error messages for NDB sql/share/greek/errmsg.txt: Added two new error messages for NDB sql/share/hungarian/errmsg.txt: Added two new error messages for NDB sql/share/italian/errmsg.txt: Added two new error messages for NDB sql/share/japanese/errmsg.txt: Added two new error messages for NDB sql/share/korean/errmsg.txt: Added two new error messages for NDB sql/share/norwegian-ny/errmsg.txt: Added two new error messages for NDB sql/share/norwegian/errmsg.txt: Added two new error messages for NDB sql/share/polish/errmsg.txt: Added two new error messages for NDB sql/share/portuguese/errmsg.txt: Added two new error messages for NDB sql/share/romanian/errmsg.txt: Added two new error messages for NDB sql/share/russian/errmsg.txt: Added two new error messages for NDB sql/share/serbian/errmsg.txt: Added two new error messages for NDB sql/share/slovak/errmsg.txt: Added two new error messages for NDB sql/share/spanish/errmsg.txt: Added two new error messages for NDB sql/share/swedish/errmsg.txt: Added two new error messages for NDB sql/share/ukrainian/errmsg.txt: Added two new error messages for NDB
2004-05-11 13:59:22 +02:00
DBUG_RETURN(close_scan());
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
int ha_ndbcluster::rnd_next(byte *buf)
{
DBUG_ENTER("rnd_next");
statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
&LOCK_status);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (!m_active_cursor)
DBUG_RETURN(full_table_scan(buf));
DBUG_RETURN(next_result(buf));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
An "interesting" record has been found and it's pk
retrieved by calling position
Now it's time to read the record from db once
again
*/
int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
{
DBUG_ENTER("rnd_pos");
statistic_increment(current_thd->status_var.ha_read_rnd_count,
&LOCK_status);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// The primary key for the record is stored in pos
// Perform a pk_read using primary key "index"
2005-07-18 13:31:02 +02:00
{
part_id_range part_spec;
if (m_use_partition_function)
{
key_range key_spec;
KEY *key_info= table->key_info + active_index;
key_spec.key= pos;
key_spec.length= ref_length;
key_spec.flag= HA_READ_KEY_EXACT;
get_full_part_id_from_key(table, buf, key_info, &key_spec, &part_spec);
DBUG_ASSERT(part_spec.start_part == part_spec.end_part);
}
DBUG_RETURN(pk_read(pos, ref_length, buf, part_spec.start_part));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Store the primary key of this record in ref
variable, so that the row can be retrieved again later
using "reference" in rnd_pos
*/
void ha_ndbcluster::position(const byte *record)
{
KEY *key_info;
KEY_PART_INFO *key_part;
KEY_PART_INFO *end;
byte *buff;
DBUG_ENTER("position");
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->primary_key != MAX_KEY)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
key_info= table->key_info + table->s->primary_key;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
key_part= key_info->key_part;
end= key_part + key_info->key_parts;
buff= ref;
for (; key_part != end; key_part++)
{
if (key_part->null_bit) {
/* Store 0 if the key part is a NULL part */
if (record[key_part->null_offset]
& key_part->null_bit) {
*buff++= 1;
continue;
}
*buff++= 0;
}
size_t len = key_part->length;
const byte * ptr = record + key_part->offset;
Field *field = key_part->field;
if ((field->type() == MYSQL_TYPE_VARCHAR) &&
((Field_varstring*)field)->length_bytes == 1)
{
/**
* Keys always use 2 bytes length
*/
buff[0] = ptr[0];
buff[1] = 0;
memcpy(buff+2, ptr + 1, len);
len += 2;
}
else
{
memcpy(buff, ptr, len);
}
buff += len;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
}
else
{
// No primary key, get hidden key
DBUG_PRINT("info", ("Getting hidden key"));
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
int hidden_no= table->s->fields;
const NdbRecAttr* rec= m_value[hidden_no].rec;
memcpy(ref, (const void*)rec->aRef(), ref_length);
#ifndef DBUG_OFF
const NDBTAB *tab= (const NDBTAB *) m_table;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
const NDBCOL *hidden_col= tab->getColumn(hidden_no);
DBUG_ASSERT(hidden_col->getPrimaryKey() &&
hidden_col->getAutoIncrement() &&
rec != NULL &&
ref_length == NDB_HIDDEN_PRIMARY_KEY_LENGTH);
#endif
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
DBUG_DUMP("ref", (char*)ref, ref_length);
DBUG_VOID_RETURN;
}
void ha_ndbcluster::info(uint flag)
{
DBUG_ENTER("info");
DBUG_PRINT("enter", ("flag: %d", flag));
if (flag & HA_STATUS_POS)
DBUG_PRINT("info", ("HA_STATUS_POS"));
if (flag & HA_STATUS_NO_LOCK)
DBUG_PRINT("info", ("HA_STATUS_NO_LOCK"));
if (flag & HA_STATUS_TIME)
DBUG_PRINT("info", ("HA_STATUS_TIME"));
if (flag & HA_STATUS_VARIABLE)
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
{
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("info", ("HA_STATUS_VARIABLE"));
if (m_table_info)
{
if (m_ha_not_exact_count)
records= 100;
else
records_update();
}
else
{
if ((my_errno= check_ndb_connection()))
DBUG_VOID_RETURN;
Ndb *ndb= get_ndb();
struct Ndb_statistics stat;
if (current_thd->variables.ndb_use_exact_count &&
ndb_get_table_statistics(ndb, m_tabname, &stat) == 0)
{
mean_rec_length= stat.row_size;
data_file_length= stat.fragment_memory;
records= stat.row_count;
}
else
{
mean_rec_length= 0;
records= 100;
}
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
}
2004-10-04 01:20:05 +02:00
if (flag & HA_STATUS_CONST)
{
DBUG_PRINT("info", ("HA_STATUS_CONST"));
set_rec_per_key();
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (flag & HA_STATUS_ERRKEY)
{
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("info", ("HA_STATUS_ERRKEY"));
errkey= m_dupkey;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (flag & HA_STATUS_AUTO)
{
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("info", ("HA_STATUS_AUTO"));
if (m_table)
{
Ndb *ndb= get_ndb();
auto_increment_value=
ndb->readAutoIncrementValue((const NDBTAB *) m_table);
}
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_VOID_RETURN;
}
int ha_ndbcluster::extra(enum ha_extra_function operation)
{
DBUG_ENTER("extra");
switch (operation) {
case HA_EXTRA_RESET: /* Reset database to after open */
DBUG_PRINT("info", ("HA_EXTRA_RESET"));
2004-12-17 21:13:22 +01:00
DBUG_PRINT("info", ("Clearing condition stack"));
cond_clear();
WL#2985 "Partition Pruning" sql/ha_ndbcluster.cc: WL#2985 "Partition Pruning": added part_info->used_partitions initialization sql/ha_partition.cc: WL#2985 "Partition Pruning": added part_info->used_partitions initialization sql/handler.h: WL#2985 "Partition Pruning": Added function prototypes in partition_info: - Added 'used_partitions' bitmap - Added comments sql/item.h: WL#2985 "Partition Pruning": - added enum monotonicity_info - added virtual Item::get_monotonicity_info() sql/item_timefunc.cc: WL#2985 "Partition Pruning": - added Item_func_to_days::get_monotonicity_info() - added Item_func_year::get_monotonicity_info() sql/item_timefunc.h: WL#2985 "Partition Pruning": - added Item_func_to_days::get_monotonicity_info() - added Item_func_year::get_monotonicity_info() sql/opt_range.cc: WL#2985 "Partition Pruning": - Split out PARAM structure into PARAM and RANGE_OPT_PARAM part. - Added partition pruning module code. sql/opt_range.h: WL#2985 "Partition Pruning": Added prune_partitions() function declaration. This is the entry point for partition pruning module sql/sql_class.cc: WL#2985 "Partition Pruning": added support for "EXPLAIN PARTITIONS SELECT ..." sql/sql_lex.h: WL#2985 "Partition Pruning": added support for "EXPLAIN PARTITIONS SELECT ..." sql/sql_partition.cc: WL#2985 "Partition Pruning": - Added get_list_array_idx_for_endpoint and get_range_... functions to support partition pruning on "partition_field < const"-like intervals. - Added partition_info::used_partitions bitmap. - Added make_used_partitions_str function - Fixed BUG#15819 sql/sql_select.cc: WL#2985 "Partition Pruning": - Added prune_partitions() invocation right before the range analysis - Added code to handle return value from prune_partitions() - Added support for "EXPLAIN PARTITIONS SELECT ..." sql/sql_yacc.yy: #2985 "Partition Pruning": added support for "EXPLAIN PARTITIONS SELECT ..."
2005-12-22 10:29:00 +01:00
if (m_part_info)
bitmap_clear_all(&m_part_info->used_partitions);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
break;
case HA_EXTRA_IGNORE_DUP_KEY: /* Dup keys don't rollback everything*/
DBUG_PRINT("info", ("HA_EXTRA_IGNORE_DUP_KEY"));
if (current_thd->lex->sql_command == SQLCOM_REPLACE)
{
DBUG_PRINT("info", ("Turning ON use of write instead of insert"));
m_use_write= TRUE;
} else
{
DBUG_PRINT("info", ("Ignoring duplicate key"));
m_ignore_dup_key= TRUE;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
break;
case HA_EXTRA_NO_IGNORE_DUP_KEY:
DBUG_PRINT("info", ("HA_EXTRA_NO_IGNORE_DUP_KEY"));
DBUG_PRINT("info", ("Turning OFF use of write instead of insert"));
m_use_write= FALSE;
m_ignore_dup_key= FALSE;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
break;
2005-07-18 13:31:02 +02:00
default:
break;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
DBUG_RETURN(0);
}
/*
Start of an insert, remember number of rows to be inserted, it will
be used in write_row and get_autoincrement to send an optimal number
of rows in each roundtrip to the server
SYNOPSIS
rows number of rows to insert, 0 if unknown
*/
void ha_ndbcluster::start_bulk_insert(ha_rows rows)
{
int bytes, batch;
const NDBTAB *tab= (const NDBTAB *) m_table;
DBUG_ENTER("start_bulk_insert");
2004-07-22 12:38:09 +02:00
DBUG_PRINT("enter", ("rows: %d", (int)rows));
m_rows_inserted= (ha_rows) 0;
if (rows == (ha_rows) 0)
2005-05-07 22:04:52 +02:00
{
/* We don't know how many will be inserted, guess */
m_rows_to_insert= m_autoincrement_prefetch;
2005-05-07 22:04:52 +02:00
}
else
m_rows_to_insert= rows;
/*
Calculate how many rows that should be inserted
per roundtrip to NDB. This is done in order to minimize the
number of roundtrips as much as possible. However performance will
degrade if too many bytes are inserted, thus it's limited by this
calculation.
*/
const int bytesperbatch= 8192;
bytes= 12 + tab->getRowSizeInBytes() + 4 * tab->getNoOfColumns();
batch= bytesperbatch/bytes;
batch= batch == 0 ? 1 : batch;
DBUG_PRINT("info", ("batch: %d, bytes: %d", batch, bytes));
m_bulk_insert_rows= batch;
DBUG_VOID_RETURN;
}
/*
End of an insert
*/
int ha_ndbcluster::end_bulk_insert()
{
int error= 0;
DBUG_ENTER("end_bulk_insert");
// Check if last inserts need to be flushed
if (m_bulk_insert_not_flushed)
{
NdbTransaction *trans= m_active_trans;
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d",
(int) m_rows_inserted, (int) m_bulk_insert_rows));
m_bulk_insert_not_flushed= FALSE;
2004-09-17 16:58:08 +02:00
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
my_errno= error= ndb_err(trans);
}
}
m_rows_inserted= (ha_rows) 0;
m_rows_to_insert= (ha_rows) 1;
DBUG_RETURN(error);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::extra_opt(enum ha_extra_function operation, ulong cache_size)
{
DBUG_ENTER("extra_opt");
2004-07-22 12:38:09 +02:00
DBUG_PRINT("enter", ("cache_size: %lu", cache_size));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(extra(operation));
}
static const char *ha_ndbcluster_exts[] = {
ha_ndb_ext,
NullS
};
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
const char** ha_ndbcluster::bas_ext() const
{
return ha_ndbcluster_exts;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
How many seeks it will take to read through the table
This is to be comparable to the number returned by records_in_range so
that we can decide if we should scan the table or use keys.
*/
double ha_ndbcluster::scan_time()
{
DBUG_ENTER("ha_ndbcluster::scan_time()");
double res= rows2double(records*1000);
DBUG_PRINT("exit", ("table: %s value: %f",
m_tabname, res));
DBUG_RETURN(res);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2005-06-20 17:16:22 +02:00
/*
Convert MySQL table locks into locks supported by Ndb Cluster.
Note that MySQL Cluster does currently not support distributed
table locks, so to be safe one should set cluster in Single
User Mode, before relying on table locks when updating tables
from several MySQL servers
*/
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)
{
DBUG_ENTER("store_lock");
if (lock_type != TL_IGNORE && m_lock.type == TL_UNLOCK)
{
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/* If we are not doing a LOCK TABLE, then allow multiple
writers */
/* Since NDB does not currently have table locks
this is treated as a ordinary lock */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
lock_type <= TL_WRITE) && !thd->in_lock_tables)
lock_type= TL_WRITE_ALLOW_WRITE;
/* In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
MySQL would use the lock TL_READ_NO_INSERT on t2, and that
would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
to t2. Convert the lock to a normal read lock to allow
concurrent inserts to t2. */
if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables)
lock_type= TL_READ;
m_lock.type=lock_type;
}
*to++= &m_lock;
DBUG_PRINT("exit", ("lock_type: %d", lock_type));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(to);
}
#ifndef DBUG_OFF
#define PRINT_OPTION_FLAGS(t) { \
if (t->options & OPTION_NOT_AUTOCOMMIT) \
DBUG_PRINT("thd->options", ("OPTION_NOT_AUTOCOMMIT")); \
if (t->options & OPTION_BEGIN) \
DBUG_PRINT("thd->options", ("OPTION_BEGIN")); \
if (t->options & OPTION_TABLE_LOCK) \
DBUG_PRINT("thd->options", ("OPTION_TABLE_LOCK")); \
}
#else
#define PRINT_OPTION_FLAGS(t)
#endif
/*
As MySQL will execute an external lock for every new table it uses
we can use this to start the transactions.
If we are in auto_commit mode we just need to start a transaction
for the statement, this will be stored in thd_ndb.stmt.
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
If not, we have to start a master transaction if there doesn't exist
one from before, this will be stored in thd_ndb.all
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
When a table lock is held one transaction will be started which holds
the table lock and for each statement a hupp transaction will be started
If we are locking the table then:
- save the NdbDictionary::Table for easy access
- save reference to table statistics
- refresh list of the indexes for the table if needed (if altered)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
int ha_ndbcluster::external_lock(THD *thd, int lock_type)
{
int error=0;
NdbTransaction* trans= NULL;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("external_lock");
/*
Check that this handler instance has a connection
set up to the Ndb object of thd
*/
if (check_ndb_connection(thd))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(1);
Thd_ndb *thd_ndb= get_thd_ndb(thd);
Ndb *ndb= thd_ndb->ndb;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
DBUG_PRINT("enter", ("this: %x thd: %lx thd_ndb: %lx "
"thd_ndb->lock_count: %d",
this, thd, thd_ndb, thd_ndb->lock_count));
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (lock_type != F_UNLCK)
{
DBUG_PRINT("info", ("lock_type != F_UNLCK"));
if (!thd->transaction.on)
m_transaction_on= FALSE;
else
m_transaction_on= thd->variables.ndb_use_transactions;
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
if (!thd_ndb->lock_count++)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
PRINT_OPTION_FLAGS(thd);
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
// Autocommit transaction
DBUG_ASSERT(!thd_ndb->stmt);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("trans",("Starting transaction stmt"));
trans= ndb->startTransaction();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (trans == NULL)
ERR_RETURN(ndb->getNdbError());
no_uncommitted_rows_reset(thd);
thd_ndb->stmt= trans;
if (m_transaction_on)
trans_register_ha(thd, FALSE, &ndbcluster_hton);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
else
{
if (!thd_ndb->all)
{
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Not autocommit transaction
// A "master" transaction ha not been started yet
DBUG_PRINT("trans",("starting transaction, all"));
trans= ndb->startTransaction();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (trans == NULL)
ERR_RETURN(ndb->getNdbError());
no_uncommitted_rows_reset(thd);
thd_ndb->all= trans;
if (m_transaction_on)
trans_register_ha(thd, TRUE, &ndbcluster_hton);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
If this is the start of a LOCK TABLE, a table look
should be taken on the table in NDB
Check if it should be read or write lock
*/
if (thd->options & (OPTION_TABLE_LOCK))
{
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
//lockThisTable();
DBUG_PRINT("info", ("Locking the table..." ));
}
}
}
}
/*
This is the place to make sure this handler instance
has a started transaction.
The transaction is started by the first handler on which
MySQL Server calls external lock
Other handlers in the same stmt or transaction should use
the same NDB transaction. This is done by setting up the m_active_trans
pointer to point to the NDB transaction.
*/
// store thread specific data first to set the right context
m_force_send= thd->variables.ndb_force_send;
m_ha_not_exact_count= !thd->variables.ndb_use_exact_count;
m_autoincrement_prefetch=
(ha_rows) thd->variables.ndb_autoincrement_prefetch_sz;
m_active_trans= thd_ndb->all ? thd_ndb->all : thd_ndb->stmt;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ASSERT(m_active_trans);
// Start of transaction
m_rows_changed= 0;
m_ops_pending= 0;
{
NDBDICT *dict= ndb->getDictionary();
const NDBTAB *tab;
void *tab_info;
if (!(tab= dict->getTable(m_tabname, &tab_info)))
ERR_RETURN(dict->getNdbError());
DBUG_PRINT("info", ("Table schema version: %d",
tab->getObjectVersion()));
// Check if thread has stale local cache
bug#12118 - ndb alter table data loss Split table version into 2 (major, minor) Impl. signaling to API when table has been altered Allow running transactions to use any minor number for transactions mysql-test/r/ndb_alter_table.result: Allow running transactions to use old table definition when possible. mysql-test/t/ndb_alter_table.test: Allow running transactions to use old table definition when possible. ndb/include/kernel/BlockNumbers.h: remove GREP ndb/include/kernel/GlobalSignalNumbers.h: Add ALTER_TABL_REP and API_BROADCAST_REP ndb/include/kernel/kernel_types.h: table_version_major ndb/include/kernel/signaldata/AlterTable.hpp: New error code for alter table during rolling upgrade ndb/include/ndbapi/NdbDictionary.hpp: Add state on table object to represent an altered but still valid table object ndb/src/common/debugger/BlockNames.cpp: remove GREP ndb/src/common/util/version.c: Fix upgrades ndb/src/kernel/SimBlockList.cpp: remove GREP ndb/src/kernel/blocks/Makefile.am: remove GREP ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: remove GREP ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Split tableSchemaVersion into 2 part 24 bit real version 8 bit for online alter table where old table definition is still usable ndb/src/kernel/blocks/dbdict/Dbdict.hpp: Check for same ndb versions ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp: Update schema printer ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: remove grep ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: 1) Use table_ version_major when checking table version 2) Dummy fix for BUG that tableSchemaVersion is only 16 bit in LQHKEYREQ ndb/src/kernel/blocks/dbtc/Dbtc.hpp: 1) Use table_ version_major when checking table version 2) Dummy fix for BUG that tableSchemaVersion is only 16 bit in LQHKEYREQ ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: 1) Use table_ version_major when checking table version 2) Dummy fix for BUG that tableSchemaVersion is only 16 bit in LQHKEYREQ ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp: remove GREP ndb/src/kernel/blocks/qmgr/Qmgr.hpp: Add support for sending REP to ALL api nodes ndb/src/kernel/blocks/qmgr/QmgrInit.cpp: Add support for sending REP to ALL api nodes ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: Add support for sending REP to ALL api nodes ndb/src/kernel/blocks/suma/Suma.cpp: remove GREP ndb/src/mgmsrv/MgmtSrvr.cpp: remove GREP ndb/src/ndbapi/DictCache.cpp: Add support for alter_table_rep by setting status to Altered NOTE special handling of tables in state RETREIVING ndb/src/ndbapi/DictCache.hpp: Add support for alter_table_rep by setting status to Altered NOTE special handling of tables in state RETREIVING ndb/src/ndbapi/NdbDictionaryImpl.cpp: Change alter table so that remove from global cache is used wo/ retreiving it from there first as ALTER_TABLE_REP might already have changed the table object... ndb/src/ndbapi/TransporterFacade.cpp: Add support for ALTER_TABLE_REP sql/ha_ndbcluster.cc: Allow running transactions to use tables in state ALTERED...but new transactions may not... ndb/include/kernel/signaldata/ApiBroadcast.hpp: New BitKeeper file ``ndb/include/kernel/signaldata/ApiBroadcast.hpp''
2005-08-18 14:02:25 +02:00
// New transaction must not use old tables... (trans != 0)
// Running might...
if ((trans && tab->getObjectStatus() != NdbDictionary::Object::Retrieved)
|| tab->getObjectStatus() == NdbDictionary::Object::Invalid)
{
invalidate_dictionary_cache(FALSE);
if (!(tab= dict->getTable(m_tabname, &tab_info)))
ERR_RETURN(dict->getNdbError());
DBUG_PRINT("info", ("Table schema version: %d",
tab->getObjectVersion()));
}
if (m_table_version < tab->getObjectVersion())
{
/*
The table has been altered, caller has to retry
*/
NdbError err= ndb->getNdbError(NDB_INVALID_SCHEMA_OBJECT);
DBUG_RETURN(ndb_to_mysql_error(&err));
}
if (m_table != (void *)tab)
{
m_table= (void *)tab;
m_table_version = tab->getObjectVersion();
if (!(my_errno= build_index_list(ndb, table, ILBP_OPEN)))
DBUG_RETURN(my_errno);
}
m_table_info= tab_info;
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
no_uncommitted_rows_init(thd);
}
else
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_PRINT("info", ("lock_type == F_UNLCK"));
if (ndb_cache_check_time && m_rows_changed)
{
DBUG_PRINT("info", ("Rows has changed and util thread is running"));
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
DBUG_PRINT("info", ("Add share to list of tables to be invalidated"));
/* NOTE push_back allocates memory using transactions mem_root! */
thd_ndb->changed_tables.push_back(m_share, &thd->transaction.mem_root);
}
pthread_mutex_lock(&m_share->mutex);
DBUG_PRINT("info", ("Invalidating commit_count"));
m_share->commit_count= 0;
m_share->commit_count_lock++;
pthread_mutex_unlock(&m_share->mutex);
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
if (!--thd_ndb->lock_count)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_PRINT("trans", ("Last external_lock"));
PRINT_OPTION_FLAGS(thd);
if (thd_ndb->stmt)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
/*
Unlock is done without a transaction commit / rollback.
This happens if the thread didn't update any rows
We must in this case close the transaction to release resources
*/
DBUG_PRINT("trans",("ending non-updating transaction"));
ndb->closeTransaction(m_active_trans);
thd_ndb->stmt= NULL;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
}
2004-09-21 14:52:56 +02:00
m_table_info= NULL;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
/*
This is the place to make sure this handler instance
no longer are connected to the active transaction.
And since the handler is no longer part of the transaction
it can't have open cursors, ops or blobs pending.
*/
m_active_trans= NULL;
if (m_active_cursor)
DBUG_PRINT("warning", ("m_active_cursor != NULL"));
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
m_active_cursor= NULL;
if (m_multi_cursor)
DBUG_PRINT("warning", ("m_multi_cursor != NULL"));
m_multi_cursor= NULL;
if (m_blobs_pending)
DBUG_PRINT("warning", ("blobs_pending != 0"));
m_blobs_pending= 0;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (m_ops_pending)
DBUG_PRINT("warning", ("ops_pending != 0L"));
m_ops_pending= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
DBUG_RETURN(error);
}
/*
Start a transaction for running a statement if one is not
already running in a transaction. This will be the case in
a BEGIN; COMMIT; block
When using LOCK TABLE's external_lock will start a transaction
since ndb does not currently does not support table locking
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
int ha_ndbcluster::start_stmt(THD *thd, thr_lock_type lock_type)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int error=0;
DBUG_ENTER("start_stmt");
PRINT_OPTION_FLAGS(thd);
Thd_ndb *thd_ndb= get_thd_ndb(thd);
NdbTransaction *trans= (thd_ndb->stmt)?thd_ndb->stmt:thd_ndb->all;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (!trans){
Ndb *ndb= thd_ndb->ndb;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("trans",("Starting transaction stmt"));
trans= ndb->startTransaction();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (trans == NULL)
ERR_RETURN(ndb->getNdbError());
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
no_uncommitted_rows_reset(thd);
thd_ndb->stmt= trans;
trans_register_ha(thd, FALSE, &ndbcluster_hton);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
m_active_trans= trans;
// Start of statement
m_ops_pending= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(error);
}
/*
Commit a transaction started in NDB
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
int ndbcluster_commit(THD *thd, bool all)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int res= 0;
Thd_ndb *thd_ndb= get_thd_ndb(thd);
Ndb *ndb= thd_ndb->ndb;
NdbTransaction *trans= all ? thd_ndb->all : thd_ndb->stmt;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ndbcluster_commit");
DBUG_PRINT("transaction",("%s",
trans == thd_ndb->stmt ?
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
"stmt" : "all"));
DBUG_ASSERT(ndb && trans);
if (execute_commit(thd,trans) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
const NdbError err= trans->getNdbError();
const NdbOperation *error_op= trans->getNdbErrorOperation();
ERR_PRINT(err);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
res= ndb_to_mysql_error(&err);
if (res != -1)
ndbcluster_print_error(res, error_op);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
ndb->closeTransaction(trans);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (all)
thd_ndb->all= NULL;
else
thd_ndb->stmt= NULL;
/* Clear commit_count for tables changed by transaction */
NDB_SHARE* share;
List_iterator_fast<NDB_SHARE> it(thd_ndb->changed_tables);
while ((share= it++))
{
pthread_mutex_lock(&share->mutex);
DBUG_PRINT("info", ("Invalidate commit_count for %s, share->commit_count: %d ",
share->key, share->commit_count));
share->commit_count= 0;
share->commit_count_lock++;
pthread_mutex_unlock(&share->mutex);
}
thd_ndb->changed_tables.empty();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(res);
}
/*
Rollback a transaction started in NDB
*/
int ndbcluster_rollback(THD *thd, bool all)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int res= 0;
Thd_ndb *thd_ndb= get_thd_ndb(thd);
Ndb *ndb= thd_ndb->ndb;
NdbTransaction *trans= all ? thd_ndb->all : thd_ndb->stmt;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ndbcluster_rollback");
DBUG_PRINT("transaction",("%s",
trans == thd_ndb->stmt ?
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
"stmt" : "all"));
DBUG_ASSERT(ndb && trans);
if (trans->execute(NdbTransaction::Rollback) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
const NdbError err= trans->getNdbError();
const NdbOperation *error_op= trans->getNdbErrorOperation();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_PRINT(err);
res= ndb_to_mysql_error(&err);
if (res != -1)
ndbcluster_print_error(res, error_op);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
ndb->closeTransaction(trans);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (all)
thd_ndb->all= NULL;
else
thd_ndb->stmt= NULL;
/* Clear list of tables changed by transaction */
thd_ndb->changed_tables.empty();
DBUG_RETURN(res);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
2004-07-22 12:38:09 +02:00
Define NDB column based on Field.
Returns 0 or mysql error code.
Not member of ha_ndbcluster because NDBCOL cannot be declared.
MySQL text types with character set "binary" are mapped to true
NDB binary types without a character set. This may change.
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
2004-07-22 12:38:09 +02:00
static int create_ndb_column(NDBCOL &col,
Field *field,
HA_CREATE_INFO *info)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
2004-07-22 12:38:09 +02:00
// Set name
BUG#9626 - Fix valgrind warnings - Remove static db, schema and table name buffers from Ndb.cpp mysys/thr_alarm.c: Initialise sact to zero ndb/include/kernel/ndb_limits.h: Set MAX_ATTR_NAME_SIZE to NAME_LEN which is tha maximum in MySQL ndb/include/kernel/signaldata/GetTabInfo.hpp: Clean up ndb/include/ndbapi/Ndb.hpp: Remove NDB_MAX_INTERNAL_NAME_LENGTH and all char buffers for schema, db and tablename. Made them dynamic and moved to NdbImpl.hpp ndb/include/ndbapi/ndbapi_limits.h: Remove the static length's of attr, db, schema and table name. ndb/src/common/transporter/Packer.cpp: Set theSignalId to ~0 when unpacking signal ndb/src/ndbapi/Ndb.cpp: Moved schema, database and tablename to NdbImpl.hpp ndb/src/ndbapi/NdbDictionaryImpl.cpp: Add NdbIndexImpl::init and NdbEventImpl::init Init all vars in NdbIndexImpl, NdbEventImpl, NdbTableImpl and NdbIndexImpl Delete the pseudo column NDB$RANGE_NO Copy tablename to internal buff in NdbDictInterface to get proper alignment. Convert length of table name from bytes words, when setting sz of LinearSectionPtr Set LinearSectionPtr array size to number of LinearSections used - save some stack. ndb/src/ndbapi/NdbDictionaryImpl.hpp: Add NdbEventImpl::init and NdbIndexImpl::init Remove clearNewProperties and copyNewProperties, it's easier to check if all vars are initied if it's done in the same func. Add buffer for tabname ti NdbDictInterface, memset it to 0 in initializer. ndb/src/ndbapi/NdbImpl.hpp: Use BaseString for table, schema and db names. ndb/src/ndbapi/Ndbinit.cpp: Move schema and db name to NdbImpl and use BaseString ndb/src/ndbapi/ndb_cluster_connection.cpp: Destroy ndb_global_event_buffer_mutex and ndb_print_state_mutex sql/ha_ndbcluster.cc: Check if pTrans is not null before calling closeTransaction Remove NDB_MAX_ATTR_NAME_SIZE Remove truncation of attr names. When attr name length is same in NDB as in MySQL this will be checked in functin check_column_name
2005-05-18 20:50:29 +02:00
col.setName(field->field_name);
2004-09-15 17:44:13 +02:00
// Get char set
CHARSET_INFO *cs= field->charset();
2004-07-22 12:38:09 +02:00
// Set type and sizes
const enum enum_field_types mysql_type= field->real_type();
switch (mysql_type) {
// Numeric types
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
case MYSQL_TYPE_TINY:
2004-07-22 12:38:09 +02:00
if (field->flags & UNSIGNED_FLAG)
col.setType(NDBCOL::Tinyunsigned);
else
col.setType(NDBCOL::Tinyint);
col.setLength(1);
break;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
case MYSQL_TYPE_SHORT:
2004-07-22 12:38:09 +02:00
if (field->flags & UNSIGNED_FLAG)
col.setType(NDBCOL::Smallunsigned);
else
col.setType(NDBCOL::Smallint);
col.setLength(1);
break;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
case MYSQL_TYPE_LONG:
2004-07-22 12:38:09 +02:00
if (field->flags & UNSIGNED_FLAG)
col.setType(NDBCOL::Unsigned);
else
col.setType(NDBCOL::Int);
col.setLength(1);
break;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
case MYSQL_TYPE_INT24:
2004-07-22 12:38:09 +02:00
if (field->flags & UNSIGNED_FLAG)
col.setType(NDBCOL::Mediumunsigned);
else
col.setType(NDBCOL::Mediumint);
col.setLength(1);
break;
case MYSQL_TYPE_LONGLONG:
if (field->flags & UNSIGNED_FLAG)
col.setType(NDBCOL::Bigunsigned);
else
col.setType(NDBCOL::Bigint);
col.setLength(1);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
break;
case MYSQL_TYPE_FLOAT:
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Float);
col.setLength(1);
break;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
case MYSQL_TYPE_DOUBLE:
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Double);
col.setLength(1);
break;
case MYSQL_TYPE_DECIMAL:
{
Field_decimal *f= (Field_decimal*)field;
uint precision= f->pack_length();
uint scale= f->decimals();
if (field->flags & UNSIGNED_FLAG)
{
col.setType(NDBCOL::Olddecimalunsigned);
precision-= (scale > 0);
}
else
{
col.setType(NDBCOL::Olddecimal);
precision-= 1 + (scale > 0);
}
col.setPrecision(precision);
col.setScale(scale);
col.setLength(1);
}
break;
case MYSQL_TYPE_NEWDECIMAL:
{
Field_new_decimal *f= (Field_new_decimal*)field;
A lot of fixes to Precision math Mostly about precision/decimals of the results of the operations include/decimal.h: decimal interface changed a little sql/field.cc: a lot of precision/decimals related changes to the Field_new_decimal sql/field.h: Field_new_decimal interface changed sql/ha_ndbcluster.cc: f->precision should be used here sql/item.cc: precision/decimals counting related changes sql/item.h: precision/decimals counting related changes sql/item_cmpfunc.cc: precision/decimals counting related changes sql/item_cmpfunc.h: precision/decimals counting related changes sql/item_func.cc: precision/decimals counting related changes sql/item_func.h: precision/decimals counting related changes sql/item_sum.cc: precision/decimals counting related changes sql/item_sum.h: precision/decimals counting related changes sql/my_decimal.cc: precision/decimals counting related changes sql/my_decimal.h: precision/decimals counting related changes sql/mysqld.cc: precision/decimals counting related changes sql/set_var.cc: precision/decimals counting related changes sql/sp_head.cc: dbug_decimal_print was replaced with dbug_decimal_as_string sql/sql_class.h: div_precincrement variable added sql/sql_parse.cc: precision/decimals counting related changes sql/sql_select.cc: precision/decimals counting related changes sql/sql_show.cc: Field::representation_length was removed strings/decimal.c: decimal_actual_fraction was introduced BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2005-05-05 17:06:49 +02:00
uint precision= f->precision;
uint scale= f->decimals();
if (field->flags & UNSIGNED_FLAG)
{
col.setType(NDBCOL::Decimalunsigned);
}
else
{
col.setType(NDBCOL::Decimal);
}
col.setPrecision(precision);
col.setScale(scale);
col.setLength(1);
}
break;
2004-07-22 12:38:09 +02:00
// Date types
case MYSQL_TYPE_DATETIME:
col.setType(NDBCOL::Datetime);
col.setLength(1);
break;
case MYSQL_TYPE_DATE: // ?
col.setType(NDBCOL::Char);
col.setLength(field->pack_length());
break;
2004-07-22 12:38:09 +02:00
case MYSQL_TYPE_NEWDATE:
col.setType(NDBCOL::Date);
col.setLength(1);
break;
2004-07-22 12:38:09 +02:00
case MYSQL_TYPE_TIME:
col.setType(NDBCOL::Time);
col.setLength(1);
break;
case MYSQL_TYPE_YEAR:
col.setType(NDBCOL::Year);
col.setLength(1);
break;
case MYSQL_TYPE_TIMESTAMP:
col.setType(NDBCOL::Timestamp);
col.setLength(1);
2004-07-22 12:38:09 +02:00
break;
// Char types
case MYSQL_TYPE_STRING:
if (field->pack_length() == 0)
{
col.setType(NDBCOL::Bit);
col.setLength(1);
}
else if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
2004-12-10 16:55:04 +01:00
{
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Binary);
2004-12-10 16:55:04 +01:00
col.setLength(field->pack_length());
2004-09-15 17:44:13 +02:00
}
else
2004-12-10 16:55:04 +01:00
{
col.setType(NDBCOL::Char);
col.setCharset(cs);
col.setLength(field->pack_length());
2004-12-10 16:55:04 +01:00
}
2004-07-22 12:38:09 +02:00
break;
case MYSQL_TYPE_VAR_STRING: // ?
case MYSQL_TYPE_VARCHAR:
{
Field_varstring* f= (Field_varstring*)field;
if (f->length_bytes == 1)
{
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Varbinary);
else {
col.setType(NDBCOL::Varchar);
col.setCharset(cs);
}
}
else if (f->length_bytes == 2)
{
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Longvarbinary);
else {
col.setType(NDBCOL::Longvarchar);
col.setCharset(cs);
}
}
else
{
return HA_ERR_UNSUPPORTED;
}
col.setLength(field->field_length);
2004-09-15 17:44:13 +02:00
}
2004-07-22 12:38:09 +02:00
break;
// Blob types (all come in as MYSQL_TYPE_BLOB)
mysql_type_tiny_blob:
case MYSQL_TYPE_TINY_BLOB:
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Blob);
2004-09-15 17:44:13 +02:00
else {
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Text);
2004-09-15 17:44:13 +02:00
col.setCharset(cs);
}
2004-07-22 12:38:09 +02:00
col.setInlineSize(256);
// No parts
col.setPartSize(0);
col.setStripeSize(0);
break;
//mysql_type_blob:
case MYSQL_TYPE_GEOMETRY:
2004-07-22 12:38:09 +02:00
case MYSQL_TYPE_BLOB:
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Blob);
2004-09-15 17:44:13 +02:00
else {
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Text);
2004-09-15 17:44:13 +02:00
col.setCharset(cs);
}
2004-07-22 12:38:09 +02:00
// Use "<=" even if "<" is the exact condition
if (field->max_length() <= (1 << 8))
goto mysql_type_tiny_blob;
else if (field->max_length() <= (1 << 16))
{
col.setInlineSize(256);
col.setPartSize(2000);
col.setStripeSize(16);
}
else if (field->max_length() <= (1 << 24))
goto mysql_type_medium_blob;
else
goto mysql_type_long_blob;
break;
mysql_type_medium_blob:
case MYSQL_TYPE_MEDIUM_BLOB:
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Blob);
2004-09-15 17:44:13 +02:00
else {
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Text);
2004-09-15 17:44:13 +02:00
col.setCharset(cs);
}
2004-07-22 12:38:09 +02:00
col.setInlineSize(256);
col.setPartSize(4000);
col.setStripeSize(8);
break;
mysql_type_long_blob:
case MYSQL_TYPE_LONG_BLOB:
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Blob);
2004-09-15 17:44:13 +02:00
else {
2004-07-22 12:38:09 +02:00
col.setType(NDBCOL::Text);
2004-09-15 17:44:13 +02:00
col.setCharset(cs);
}
2004-07-22 12:38:09 +02:00
col.setInlineSize(256);
col.setPartSize(8000);
col.setStripeSize(4);
break;
// Other types
case MYSQL_TYPE_ENUM:
col.setType(NDBCOL::Char);
col.setLength(field->pack_length());
break;
case MYSQL_TYPE_SET:
col.setType(NDBCOL::Char);
col.setLength(field->pack_length());
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case MYSQL_TYPE_BIT:
{
2004-12-23 15:28:41 +01:00
int no_of_bits= field->field_length*8 + ((Field_bit *) field)->bit_len;
col.setType(NDBCOL::Bit);
if (!no_of_bits)
col.setLength(1);
else
col.setLength(no_of_bits);
break;
}
2004-07-22 12:38:09 +02:00
case MYSQL_TYPE_NULL:
goto mysql_type_unsupported;
mysql_type_unsupported:
default:
return HA_ERR_UNSUPPORTED;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2004-07-22 12:38:09 +02:00
// Set nullable and pk
col.setNullable(field->maybe_null());
col.setPrimaryKey(field->flags & PRI_KEY_FLAG);
// Set autoincrement
if (field->flags & AUTO_INCREMENT_FLAG)
{
col.setAutoIncrement(TRUE);
ulonglong value= info->auto_increment_value ?
info->auto_increment_value : (ulonglong) 1;
2004-07-22 12:38:09 +02:00
DBUG_PRINT("info", ("Autoincrement key, initial: %llu", value));
col.setAutoIncrementInitialValue(value);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2004-07-22 12:38:09 +02:00
else
col.setAutoIncrement(FALSE);
2004-07-22 12:38:09 +02:00
return 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Create a table in NDB Cluster
*/
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::create(const char *name,
TABLE *form,
HA_CREATE_INFO *info)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
NDBTAB tab;
NDBCOL col;
uint pack_length, length, i, pk_length= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
const void *data, *pack_data;
char name2[FN_HEADLEN];
bool create_from_engine= (info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
DBUG_ENTER("ha_ndbcluster::create");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("name: %s", name));
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
WL#1324 table name to file name encoding - Encoding itself, implemented as a charset "filename". Originally planned to use '.' as an escape character, but now changed to '@' for two reasons: "ls" does not return file names starting with '.' considering them as a kind of hidden files; some platforms do not allow several dots in a file name. - replacing many calls of my_snprintf() and strnxmov() to the new build_table_filename(). - Adding MY_APPEND_EXT mysys flag, to append an extention rather that replace it. - Replacing all numeric constants in fn_format flag arguments to their mysys definitions, e.g. MY_UNPACK_FILENAME, - Predictability in several function/methods: when a table name can appear with or withot .frm extension. Some functions/methods were changed so accept names strictly with .frm, other - strictly without .frm extensions. Several DBUG_ASSERTs were added to check whether an extension is passed. Many files: table name to file name encoding mysql_priv.h: Prototypes for new table name encoding tools. ctype-utf8.c: Implementing "filename" charset for table name to file name encoding. row0mysql.c: Fixing table name prefix. mf_format.c: Adding MY_APPEND_EXT processing. Many files: Fixing tests. my_sys.h: Adding new flag to append rather than replace an extension. m_ctype.h: Adding "filename" charset definition. include/m_ctype.h: Adding "filename" charset definition. include/my_sys.h: Adding new flag to append rather than replace an extension. mysql-test/t/alter_table.test: Fixing tests. mysql-test/t/create.test: Fixing tests. mysql-test/t/show_check.test: Fixing tests. mysql-test/r/alter_table.result: Fixing tests. mysql-test/r/create.result: Fixing tests. mysql-test/r/mysqldump.result: Fixing tests. mysys/mf_format.c: Adding MY_APPEND_EXT processing. sql/discover.cc: table name to file name encoding sql/ha_berkeley.cc: table name to file name encoding sql/ha_innodb.cc: table name to file name encoding sql/ha_myisam.cc: table name to file name encoding sql/ha_myisammrg.cc: table name to file name encoding sql/ha_ndbcluster.cc: table name to file name encoding sql/ha_partition.cc: table name to file name encoding sql/handler.cc: table name to file name encoding. sql/init.cc: table name to file name encoding sql/mysqld.cc: table name to file name encoding sql/parse_file.cc: table name to file name encoding sql/sql_acl.cc: table name to file name encoding sql/sql_base.cc: table name to file name encoding sql/sql_db.cc: table name to file name encoding sql/sql_delete.cc: table name to file name encoding sql/sql_rename.cc: table name to file name encoding sql/sql_show.cc: table name to file name encoding sql/sql_table.cc: table name to file name encoding sql/sql_trigger.cc: table name to file name encoding sql/sql_view.cc: table name to file name encoding sql/strfunc.cc: table name to file name encoding sql/table.cc: table name to file name encoding sql/unireg.cc: table name to file name encoding storage/innobase/row/row0mysql.c: Fixing table name prefix. , storage/myisam/mi_create.c: table name to file name encoding storage/myisam/mi_delete_table.c: table name to file name encoding storage/myisam/mi_open.c: table name to file name encoding storage/myisam/mi_rename.c: table name to file name encoding strings/ctype-utf8.c: Implementing "filename" charset for table name to file name encoding. sql/mysql_priv.h: Prototypes for new table name encoding tools. storage/myisammrg/myrg_create.c: table name to file name encoding storage/myisammrg/myrg_open.c: table name to file name encoding
2005-12-31 06:01:26 +01:00
strcpy(name2, name);
DBUG_ASSERT(*fn_rext((char*)name2) == 0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
set_dbname(name2);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
set_tabname(name2);
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
table= form;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (create_from_engine)
{
/*
Table alreay exists in NDB and frm file has been created by
caller.
Do Ndb specific stuff, such as create a .ndb file
*/
if ((my_errno= write_ndb_file()))
DBUG_RETURN(my_errno);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
DBUG_RETURN(my_errno);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("table", ("name: %s", m_tabname));
tab.setName(m_tabname);
tab.setLogging(!(info->options & HA_LEX_CREATE_TMP_TABLE));
// Save frm data for this table
if (readfrm(name, &data, &length))
DBUG_RETURN(1);
if (packfrm(data, length, &pack_data, &pack_length))
DBUG_RETURN(2);
DBUG_PRINT("info", ("setFrm data=%lx len=%d", pack_data, pack_length));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
tab.setFrm(pack_data, pack_length);
my_free((char*)data, MYF(0));
my_free((char*)pack_data, MYF(0));
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
for (i= 0; i < form->s->fields; i++)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Field *field= form->field[i];
DBUG_PRINT("info", ("name: %s, type: %u, pack_length: %d",
field->field_name, field->real_type(),
field->pack_length()));
if ((my_errno= create_ndb_column(col, field, info)))
2004-07-22 12:38:09 +02:00
DBUG_RETURN(my_errno);
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
if (
#ifdef NDB_DISKDATA
info->store_on_disk ||
#else
getenv("NDB_DEFAULT_DISK"))
#endif
col.setStorageType(NdbDictionary::Column::StorageTypeDisk);
else
col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
tab.addColumn(col);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (col.getPrimaryKey())
pk_length += (field->pack_length() + 3) / 4;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
KEY* key_info;
for (i= 0, key_info= form->key_info; i < form->s->keys; i++, key_info++)
{
KEY_PART_INFO *key_part= key_info->key_part;
KEY_PART_INFO *end= key_part + key_info->key_parts;
for (; key_part != end; key_part++)
tab.getColumn(key_part->fieldnr-1)->setStorageType(
NdbDictionary::Column::StorageTypeMemory);
}
#ifdef NDB_DISKDATA
if (info->store_on_disk)
if (info->tablespace)
tab.setTablespace(info->tablespace);
else
tab.setTablespace("DEFAULT-TS");
#endif
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// No primary key, create shadow key as 64 bit, auto increment
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (form->s->primary_key == MAX_KEY)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_PRINT("info", ("Generating shadow key"));
col.setName("$PK");
col.setType(NdbDictionary::Column::Bigunsigned);
col.setLength(1);
col.setNullable(FALSE);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
col.setPrimaryKey(TRUE);
col.setAutoIncrement(TRUE);
tab.addColumn(col);
pk_length += 2;
}
// Make sure that blob tables don't have to big part size
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
for (i= 0; i < form->s->fields; i++)
{
/**
* The extra +7 concists
* 2 - words from pk in blob table
* 5 - from extra words added by tup/dict??
*/
switch (form->field[i]->real_type()) {
case MYSQL_TYPE_GEOMETRY:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
{
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
NdbDictionary::Column * col= tab.getColumn(i);
int size= pk_length + (col->getPartSize()+3)/4 + 7;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (size > NDB_MAX_TUPLE_SIZE_IN_WORDS &&
(pk_length+7) < NDB_MAX_TUPLE_SIZE_IN_WORDS)
{
size= NDB_MAX_TUPLE_SIZE_IN_WORDS - pk_length - 7;
col->setPartSize(4*size);
}
/**
* If size > NDB_MAX and pk_length+7 >= NDB_MAX
* then the table can't be created anyway, so skip
* changing part size, and have error later
*/
}
default:
break;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2005-02-11 22:33:52 +01:00
2005-07-18 13:31:02 +02:00
// Check partition info
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
partition_info *part_info= form->part_info;
2005-07-18 13:31:02 +02:00
if (part_info)
{
int error;
if ((error= set_up_partition_info(part_info, form, (void*)&tab)))
{
DBUG_RETURN(error);
}
}
else
{
ndb_set_fragmentation(tab, form, pk_length);
}
2005-02-11 22:33:52 +01:00
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if ((my_errno= check_ndb_connection()))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(my_errno);
// Create the table in NDB
Ndb *ndb= get_ndb();
NDBDICT *dict= ndb->getDictionary();
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (dict->createTable(tab) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
const NdbError err= dict->getNdbError();
ERR_PRINT(err);
my_errno= ndb_to_mysql_error(&err);
DBUG_RETURN(my_errno);
}
DBUG_PRINT("info", ("Table %s/%s created successfully",
m_dbname, m_tabname));
2004-08-19 11:10:35 +02:00
// Create secondary indexes
my_errno= build_index_list(ndb, form, ILBP_CREATE);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (!my_errno)
my_errno= write_ndb_file();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(my_errno);
}
int ha_ndbcluster::create_ordered_index(const char *name,
KEY *key_info)
{
DBUG_ENTER("ha_ndbcluster::create_ordered_index");
DBUG_RETURN(create_index(name, key_info, FALSE));
}
int ha_ndbcluster::create_unique_index(const char *name,
KEY *key_info)
{
DBUG_ENTER("ha_ndbcluster::create_unique_index");
DBUG_RETURN(create_index(name, key_info, TRUE));
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Create an index in NDB Cluster
*/
int ha_ndbcluster::create_index(const char *name,
KEY *key_info,
bool unique)
{
Ndb *ndb= get_ndb();
NdbDictionary::Dictionary *dict= ndb->getDictionary();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
KEY_PART_INFO *key_part= key_info->key_part;
KEY_PART_INFO *end= key_part + key_info->key_parts;
DBUG_ENTER("ha_ndbcluster::create_index");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("name: %s ", name));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
NdbDictionary::Index ndb_index(name);
if (unique)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ndb_index.setType(NdbDictionary::Index::UniqueHashIndex);
else
{
ndb_index.setType(NdbDictionary::Index::OrderedIndex);
// TODO Only temporary ordered indexes supported
ndb_index.setLogging(FALSE);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
ndb_index.setTable(m_tabname);
for (; key_part != end; key_part++)
{
Field *field= key_part->field;
DBUG_PRINT("info", ("attr: %s", field->field_name));
BUG#9626 - Fix valgrind warnings - Remove static db, schema and table name buffers from Ndb.cpp mysys/thr_alarm.c: Initialise sact to zero ndb/include/kernel/ndb_limits.h: Set MAX_ATTR_NAME_SIZE to NAME_LEN which is tha maximum in MySQL ndb/include/kernel/signaldata/GetTabInfo.hpp: Clean up ndb/include/ndbapi/Ndb.hpp: Remove NDB_MAX_INTERNAL_NAME_LENGTH and all char buffers for schema, db and tablename. Made them dynamic and moved to NdbImpl.hpp ndb/include/ndbapi/ndbapi_limits.h: Remove the static length's of attr, db, schema and table name. ndb/src/common/transporter/Packer.cpp: Set theSignalId to ~0 when unpacking signal ndb/src/ndbapi/Ndb.cpp: Moved schema, database and tablename to NdbImpl.hpp ndb/src/ndbapi/NdbDictionaryImpl.cpp: Add NdbIndexImpl::init and NdbEventImpl::init Init all vars in NdbIndexImpl, NdbEventImpl, NdbTableImpl and NdbIndexImpl Delete the pseudo column NDB$RANGE_NO Copy tablename to internal buff in NdbDictInterface to get proper alignment. Convert length of table name from bytes words, when setting sz of LinearSectionPtr Set LinearSectionPtr array size to number of LinearSections used - save some stack. ndb/src/ndbapi/NdbDictionaryImpl.hpp: Add NdbEventImpl::init and NdbIndexImpl::init Remove clearNewProperties and copyNewProperties, it's easier to check if all vars are initied if it's done in the same func. Add buffer for tabname ti NdbDictInterface, memset it to 0 in initializer. ndb/src/ndbapi/NdbImpl.hpp: Use BaseString for table, schema and db names. ndb/src/ndbapi/Ndbinit.cpp: Move schema and db name to NdbImpl and use BaseString ndb/src/ndbapi/ndb_cluster_connection.cpp: Destroy ndb_global_event_buffer_mutex and ndb_print_state_mutex sql/ha_ndbcluster.cc: Check if pTrans is not null before calling closeTransaction Remove NDB_MAX_ATTR_NAME_SIZE Remove truncation of attr names. When attr name length is same in NDB as in MySQL this will be checked in functin check_column_name
2005-05-18 20:50:29 +02:00
ndb_index.addColumnName(field->field_name);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
if (dict->createIndex(ndb_index))
ERR_RETURN(dict->getNdbError());
// Success
DBUG_PRINT("info", ("Created index %s", name));
DBUG_RETURN(0);
}
/*
Rename a table in NDB Cluster
*/
int ha_ndbcluster::rename_table(const char *from, const char *to)
{
NDBDICT *dict;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
char new_tabname[FN_HEADLEN];
const NDBTAB *orig_tab;
int result;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ha_ndbcluster::rename_table");
DBUG_PRINT("info", ("Renaming %s to %s", from, to));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
set_dbname(from);
set_tabname(from);
set_tabname(to, new_tabname);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (check_ndb_connection())
DBUG_RETURN(my_errno= HA_ERR_NO_CONNECTION);
2005-01-03 11:56:51 +01:00
Ndb *ndb= get_ndb();
dict= ndb->getDictionary();
if (!(orig_tab= dict->getTable(m_tabname)))
ERR_RETURN(dict->getNdbError());
// Check if thread has stale local cache
if (orig_tab->getObjectStatus() == NdbDictionary::Object::Invalid)
{
dict->removeCachedTable(m_tabname);
if (!(orig_tab= dict->getTable(m_tabname)))
ERR_RETURN(dict->getNdbError());
}
m_table= (void *)orig_tab;
// Change current database to that of target table
set_dbname(to);
2005-01-03 11:56:51 +01:00
ndb->setDatabaseName(m_dbname);
if ((result= alter_table_name(new_tabname)))
{
DBUG_RETURN(result);
}
// Rename .ndb file
if ((result= handler::rename_table(from, to)))
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
{
// ToDo in 4.1 should rollback alter table...
DBUG_RETURN(result);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(result);
}
/*
Rename a table in NDB Cluster using alter table
*/
int ha_ndbcluster::alter_table_name(const char *to)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Ndb *ndb= get_ndb();
NDBDICT *dict= ndb->getDictionary();
const NDBTAB *orig_tab= (const NDBTAB *) m_table;
DBUG_ENTER("alter_table_name");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
2004-12-07 10:27:22 +01:00
NdbDictionary::Table new_tab= *orig_tab;
new_tab.setName(to);
if (dict->alterTable(new_tab) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ERR_RETURN(dict->getNdbError());
m_table= NULL;
2004-09-21 14:52:56 +02:00
m_table_info= NULL;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
/*
Delete table from NDB Cluster
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
/* static version which does not need a handler */
int
ha_ndbcluster::delete_table(ha_ndbcluster *h, Ndb *ndb,
const char *path,
const char *db,
const char *table_name)
{
DBUG_ENTER("ha_ndbcluster::ndbcluster_delete_table");
NDBDICT *dict= ndb->getDictionary();
/* Drop the table from NDB */
int res;
if (h)
{
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
res= h->intern_drop_table();
}
else
{
ndb->setDatabaseName(db);
res= dict->dropTable(table_name);
}
if (res)
{
DBUG_RETURN(res);
}
DBUG_RETURN(0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
int ha_ndbcluster::delete_table(const char *name)
{
DBUG_ENTER("ha_ndbcluster::delete_table");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("name: %s", name));
set_dbname(name);
set_tabname(name);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (check_ndb_connection())
DBUG_RETURN(HA_ERR_NO_CONNECTION);
/* Call ancestor function to delete .ndb file */
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
handler::delete_table(name);
DBUG_RETURN(delete_table(this, get_ndb(),name, m_dbname, m_tabname));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Drop table in NDB Cluster
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
int ha_ndbcluster::intern_drop_table()
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Ndb *ndb= get_ndb();
NdbDictionary::Dictionary *dict= ndb->getDictionary();
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
DBUG_ENTER("intern_drop_table");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("enter", ("Deleting %s", m_tabname));
release_metadata();
if (dict->dropTable(m_tabname))
ERR_RETURN(dict->getNdbError());
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
Added options --auto-increment-increment and --auto-increment-offset. This allows one to setup a master <-> master replication with non conflicting auto-increment series. Cleaned up binary log code to make it easyer to add new state variables. Added simpler 'upper level' logic for artificial events (events that should not cause cleanups on slave). Simplified binary log handling. Changed how auto_increment works together with to SET INSERT_ID=# to make it more predictable: Now the inserted rows in a multi-row statement are set independent of the existing rows in the table. (Before only InnoDB did this correctly) mysql-test/r/mix_innodb_myisam_binlog.result: Disable End_log_pos column from 'show binlog events' as this is now different from before mysql-test/t/mix_innodb_myisam_binlog.test: Disable End_log_pos column from 'show binlog events' as this is now different from before sql/ha_berkeley.cc: Changed prototype for get_auto_increment() sql/ha_berkeley.h: Changed prototype for get_auto_increment() sql/ha_heap.cc: Changed prototype for get_auto_increment() sql/ha_heap.h: Changed prototype for get_auto_increment() sql/ha_innodb.cc: Change how auto-increment is calculated. Now the auto-increment logic is done in 'update_auto_increment()' to ensure that all handlers has the same auto-increment usage sql/ha_innodb.h: Changed prototype for get_auto_increment() sql/ha_myisam.cc: Changed prototype for get_auto_increment() sql/ha_myisam.h: Changed prototype for get_auto_increment() sql/ha_ndbcluster.cc: Changed prototype for get_auto_increment() sql/ha_ndbcluster.h: Changed prototype for get_auto_increment() sql/handler.cc: Remove some usage of current_thd Changed how auto_increment works with SET INSERT_ID to make it more predictable (Now we should generate same auto-increment serie on a slave, even if the table has rows that was not on the master. Use auto_increment_increment and auto_increment_offset sql/handler.h: Changed prototype for get_auto_increment() sql/log.cc: Remove usage of 'set_log_pos()' to make code simpler. (Now log_pos is set in write_header()) Use 'data_written' instead of 'get_event_len()' to calculate how much data was written in the log sql/log_event.cc: Simple optimizations. Remove cached_event_len (not used variable) Made comments fit into 79 chars Removed Log_event::set_log_pos(). Now we calculate log_pos in write_header(). Renamed write_data() to write() as the original write() function was not needed anymore. Call writing of event header from event::write() functions. This made it easier to calculate the length of an event. Simplified 'write_header' and remove 'switches' from it. Changed all write() functions to return 'bool'. (The previous return values where not consistent) Store auto_increment_increment and auto_increment_offset in binary log Simplified how Query_log_event's where written and read. Now it's much easier to add now status variables for a query event to the binary log. Removed some old MySQL 4.x code to make it easier to grep for functions used in 5.0 sql/log_event.h: Changed return type of write() functions to bool. (Before we returned -1 or 1 for errors) write_data() -> write() Added 'data_written' member to make it easier to get length of written event. Removed 'cached_event_len' and 'get_event_len()' Added usage of auto_increment_increment and auto_increment_offset Added 'artifical_event' to Start_log_event_v3, to hide logic that we in the binary log use log_pos=0 as a flag for an artifical event. sql/mysqld.cc: Added options --auto-increment-increment and --auto-increment-offset sql/set_var.cc: Added variables auto_increment_increment and auto_increment_offset sql/slave.cc: Changed errors -> warnings & information (in error log) sql/sql_class.cc: Added THD::cleanup_after_query(). This makes some code simpler and allows us to clean up 'next_insert_id' after query sql/sql_class.h: Added new auto_increment_xxx variables Moved some functions/variables in THD class sql/sql_help.cc: Removed compiler warning sql/sql_insert.cc: Call 'restore_auto_increment()' if row was not inserted. This makes it easier for handler to reuse the last generated auto-incrment value that was not used (for example in case of duplicate key) sql/sql_parse.cc: Use cleanup_after_query() sql/sql_prepare.cc: Use cleanup_after_query() sql/sql_table.cc: R
2004-09-15 21:10:31 +02:00
ulonglong ha_ndbcluster::get_auto_increment()
{
Added options --auto-increment-increment and --auto-increment-offset. This allows one to setup a master <-> master replication with non conflicting auto-increment series. Cleaned up binary log code to make it easyer to add new state variables. Added simpler 'upper level' logic for artificial events (events that should not cause cleanups on slave). Simplified binary log handling. Changed how auto_increment works together with to SET INSERT_ID=# to make it more predictable: Now the inserted rows in a multi-row statement are set independent of the existing rows in the table. (Before only InnoDB did this correctly) mysql-test/r/mix_innodb_myisam_binlog.result: Disable End_log_pos column from 'show binlog events' as this is now different from before mysql-test/t/mix_innodb_myisam_binlog.test: Disable End_log_pos column from 'show binlog events' as this is now different from before sql/ha_berkeley.cc: Changed prototype for get_auto_increment() sql/ha_berkeley.h: Changed prototype for get_auto_increment() sql/ha_heap.cc: Changed prototype for get_auto_increment() sql/ha_heap.h: Changed prototype for get_auto_increment() sql/ha_innodb.cc: Change how auto-increment is calculated. Now the auto-increment logic is done in 'update_auto_increment()' to ensure that all handlers has the same auto-increment usage sql/ha_innodb.h: Changed prototype for get_auto_increment() sql/ha_myisam.cc: Changed prototype for get_auto_increment() sql/ha_myisam.h: Changed prototype for get_auto_increment() sql/ha_ndbcluster.cc: Changed prototype for get_auto_increment() sql/ha_ndbcluster.h: Changed prototype for get_auto_increment() sql/handler.cc: Remove some usage of current_thd Changed how auto_increment works with SET INSERT_ID to make it more predictable (Now we should generate same auto-increment serie on a slave, even if the table has rows that was not on the master. Use auto_increment_increment and auto_increment_offset sql/handler.h: Changed prototype for get_auto_increment() sql/log.cc: Remove usage of 'set_log_pos()' to make code simpler. (Now log_pos is set in write_header()) Use 'data_written' instead of 'get_event_len()' to calculate how much data was written in the log sql/log_event.cc: Simple optimizations. Remove cached_event_len (not used variable) Made comments fit into 79 chars Removed Log_event::set_log_pos(). Now we calculate log_pos in write_header(). Renamed write_data() to write() as the original write() function was not needed anymore. Call writing of event header from event::write() functions. This made it easier to calculate the length of an event. Simplified 'write_header' and remove 'switches' from it. Changed all write() functions to return 'bool'. (The previous return values where not consistent) Store auto_increment_increment and auto_increment_offset in binary log Simplified how Query_log_event's where written and read. Now it's much easier to add now status variables for a query event to the binary log. Removed some old MySQL 4.x code to make it easier to grep for functions used in 5.0 sql/log_event.h: Changed return type of write() functions to bool. (Before we returned -1 or 1 for errors) write_data() -> write() Added 'data_written' member to make it easier to get length of written event. Removed 'cached_event_len' and 'get_event_len()' Added usage of auto_increment_increment and auto_increment_offset Added 'artifical_event' to Start_log_event_v3, to hide logic that we in the binary log use log_pos=0 as a flag for an artifical event. sql/mysqld.cc: Added options --auto-increment-increment and --auto-increment-offset sql/set_var.cc: Added variables auto_increment_increment and auto_increment_offset sql/slave.cc: Changed errors -> warnings & information (in error log) sql/sql_class.cc: Added THD::cleanup_after_query(). This makes some code simpler and allows us to clean up 'next_insert_id' after query sql/sql_class.h: Added new auto_increment_xxx variables Moved some functions/variables in THD class sql/sql_help.cc: Removed compiler warning sql/sql_insert.cc: Call 'restore_auto_increment()' if row was not inserted. This makes it easier for handler to reuse the last generated auto-incrment value that was not used (for example in case of duplicate key) sql/sql_parse.cc: Use cleanup_after_query() sql/sql_prepare.cc: Use cleanup_after_query() sql/sql_table.cc: R
2004-09-15 21:10:31 +02:00
int cache_size;
Uint64 auto_value;
2004-07-02 11:50:28 +02:00
DBUG_ENTER("get_auto_increment");
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
Ndb *ndb= get_ndb();
if (m_rows_inserted > m_rows_to_insert)
2005-05-07 22:04:52 +02:00
{
/* We guessed too low */
m_rows_to_insert+= m_autoincrement_prefetch;
2005-05-07 22:04:52 +02:00
}
cache_size=
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
(int) ((m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
m_rows_to_insert - m_rows_inserted :
((m_rows_to_insert > m_autoincrement_prefetch) ?
m_rows_to_insert : m_autoincrement_prefetch));
auto_value= NDB_FAILED_AUTO_INCREMENT;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
auto_value=
(m_skip_auto_increment) ?
ndb->readAutoIncrementValue((const NDBTAB *) m_table)
: ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size);
} while (auto_value == NDB_FAILED_AUTO_INCREMENT &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (auto_value == NDB_FAILED_AUTO_INCREMENT)
{
const NdbError err= ndb->getNdbError();
sql_print_error("Error %lu in ::get_auto_increment(): %s",
(ulong) err.code, err.message);
DBUG_RETURN(~(ulonglong) 0);
}
2004-07-02 11:50:28 +02:00
DBUG_RETURN((longlong)auto_value);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Constructor for the NDB Cluster table handler
*/
#define HA_NDBCLUSTER_TABLE_FLAGS \
HA_REC_NOT_IN_SEQ | \
HA_NULL_IN_KEY | \
HA_AUTO_PART_KEY | \
HA_NO_PREFIX_CHAR_KEYS | \
HA_NEED_READ_RANGE_BUFFER | \
HA_CAN_GEOMETRY | \
HA_CAN_BIT_FIELD
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
ha_ndbcluster::ha_ndbcluster(TABLE_SHARE *table_arg):
A fix and a test case for Bug#10760 and complementary cleanups. The idea of the patch is that every cursor gets its own lock id for table level locking. Thus cursors are protected from updates performed within the same connection. Additionally a list of transient (must be closed at commit) cursors is maintained and all transient cursors are closed when necessary. Lastly, this patch adds support for deadlock timeouts to TLL locking when using cursors. + post-review fixes. include/thr_lock.h: - add a notion of lock owner to table level locking. When using cursors, lock owner can not be identified by a thread id any more, as we must protect cursors from updates issued within the same connection (thread). So, each cursor has its own lock identifier to use with table level locking. - extend return values of thr_lock and thr_multi_lock with THR_LOCK_TIMEOUT and THR_LOCK_DEADLOCK, since these conditions are now possible (see comments to thr_lock.c) mysys/thr_lock.c: Better support for cursors: - use THR_LOCK_OWNER * as lock identifier, not pthread_t. - check and return an error for a trivial deadlock case, when an update statement is issued to a table locked by a cursor which has been previously opened in the same connection. - add support for locking timeouts: with use of cursors, trivial deadlocks can occur. For now the only remedy is the lock wait timeout, which is initialized from a new global variable 'table_lock_wait_timeout' Example of a deadlock (assuming the storage engine does not downgrade locks): con1: open cursor for select * from t1; con2: open cursor for select * from t2; con1: update t2 set id=id*2; -- blocked con2: update t1 set id=id*2; -- deadlock Lock timeouts are active only if a connection is using cursors. - the check in the wait_for_lock loop has been changed from data->cond != cond to data->cond != 0. data->cond is zeroed in every place it's changed. - added comments sql/examples/ha_archive.cc: - extend the handlerton with the info about cursor behaviour at commit. sql/examples/ha_archive.h: - ctor moved to .cc to make use of archive handlerton sql/examples/ha_example.cc: - add handlerton instance, init handler::ht with it sql/examples/ha_example.h: - ctor moved to .cc to make use of ha_example handlerton sql/examples/ha_tina.cc: - add handlerton instance, init handler::ht with it sql/examples/ha_tina.h: - ctor moved to .cc to make use of CSV handlerton sql/ha_berkeley.cc: - init handlerton::flags and handler::ht sql/ha_berkeley.h: - ctor moved to .cc to make use of BerkeleyDB handlerton sql/ha_blackhole.cc: - add handlerton instance, init handler::ht with it sql/ha_blackhole.h: - ctor moved to .cc to make use of blackhole handlerton sql/ha_federated.cc: - add handlerton instance, init handler::ht with it sql/ha_federated.h: - ctor moved to .cc to make use of federated handlerton sql/ha_heap.cc: - add handlerton instance, init handler::ht with it sql/ha_heap.h: - ctor moved to .cc to make use of ha_heap handlerton sql/ha_innodb.cc: - init handlerton::flags and handler::ht of innobase storage engine sql/ha_innodb.h: - ctor moved to .cc to make use of archive handlerton sql/ha_myisam.cc: - add handlerton instance, init handler::ht with it sql/ha_myisam.h: - ctor moved to .cc to make use of MyISAM handlerton sql/ha_myisammrg.cc: - init handler::ht in the ctor sql/ha_myisammrg.h: - ctor moved to .cc to make use of MyISAM MERGE handlerton sql/ha_ndbcluster.cc: - init handlerton::flags and handler::ht sql/handler.cc: - drop support for ISAM storage engine, which was removed from 5.0 - close all "transient" cursors at COMMIT/ROLLBACK. A "transient" SQL level cursor is a cursor that uses tables that have a transaction- specific state. sql/handler.h: - extend struct handlerton with flags, add handlerton *ht to every handler instance. sql/lock.cc: - extend mysql_lock_tables to send error to the client if thr_multi_lock returns a timeout or a deadlock error. sql/mysqld.cc: - add server option --table_lock_wait_timeout (in seconds) sql/set_var.cc: - add new global variable 'table_lock_wait_timeout' to specify a wait timeout for table-level locks of MySQL (in seconds). The default timeout is 50 seconds. The timeout is active only if the connection has open cursors. sql/sql_class.cc: - implement Statement_map::close_transient_cursors - safety suggests that we need an assert ensuring llock_info->n_cursors is functioning properly, adjust destruction of the Statement_map to allow such assert in THD::~THD sql/sql_class.h: - add support for Cursors registry to Statement map. sql/sql_prepare.cc: - maintain a list of cursors that must be closed at commit/rollback. sql/sql_select.cc: - extend class Cursor to support specific at-COMMIT/ROLLBACK behavior. If a cursor uses tables of a storage engine that invalidates all open tables at COMMIT/ROLLBACK, it must be closed before COMMIT/ROLLBACK is executed. sql/sql_select.h: - add an own lock_id and commit/rollback status flag to class Cursor tests/mysql_client_test.c: A test case for Bug#10760 and complementary issues: test a simple deadlock case too. mysql-test/var: New BitKeeper file ``mysql-test/var''
2005-07-19 20:21:12 +02:00
handler(&ndbcluster_hton, table_arg),
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
m_active_trans(NULL),
m_active_cursor(NULL),
m_table(NULL),
m_table_version(-1),
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
m_table_info(NULL),
m_table_flags(HA_NDBCLUSTER_TABLE_FLAGS),
m_share(0),
2005-07-18 13:31:02 +02:00
m_part_info(NULL),
m_use_partition_function(FALSE),
m_sorted(FALSE),
m_use_write(FALSE),
m_ignore_dup_key(FALSE),
m_primary_key_update(FALSE),
m_ignore_no_key(FALSE),
m_rows_to_insert((ha_rows) 1),
m_rows_inserted((ha_rows) 0),
m_bulk_insert_rows((ha_rows) 1024),
m_rows_changed((ha_rows) 0),
m_bulk_insert_not_flushed(FALSE),
m_ops_pending(0),
m_skip_auto_increment(TRUE),
m_blobs_pending(0),
m_blobs_buffer(0),
m_blobs_buffer_size(0),
m_dupkey((uint) -1),
m_ha_not_exact_count(FALSE),
m_force_send(TRUE),
m_autoincrement_prefetch((ha_rows) 32),
m_transaction_on(TRUE),
2005-02-11 22:05:24 +01:00
m_cond_stack(NULL),
m_multi_cursor(NULL)
{
int i;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ha_ndbcluster");
m_tabname[0]= '\0';
m_dbname[0]= '\0';
records= ~(ha_rows)0; // uninitialized
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
block_size= 1024;
for (i= 0; i < MAX_KEY; i++)
{
m_index[i].type= UNDEFINED_INDEX;
m_index[i].unique_index= NULL;
m_index[i].index= NULL;
m_index[i].unique_index_attrid_map= NULL;
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
m_index[i].index_stat=NULL;
m_index[i].index_stat_cache_entries=0;
m_index[i].index_stat_update_freq=0;
m_index[i].index_stat_query_count=0;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_VOID_RETURN;
}
/*
Destructor for NDB Cluster table handler
*/
ha_ndbcluster::~ha_ndbcluster()
{
DBUG_ENTER("~ha_ndbcluster");
if (m_share)
{
free_share(&m_share);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
release_metadata();
my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
m_blobs_buffer= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Check for open cursor/transaction
if (m_active_cursor) {
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ASSERT(m_active_cursor == NULL);
if (m_active_trans) {
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ASSERT(m_active_trans == NULL);
2004-12-17 21:13:22 +01:00
// Discard the condition stack
DBUG_PRINT("info", ("Clearing condition stack"));
cond_clear();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_VOID_RETURN;
}
2005-02-11 22:33:52 +01:00
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Open a table for further use
- fetch metadata for this table from NDB
- check that table exists
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
RETURN
0 ok
< 0 Table has changed
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked)
{
2004-10-04 01:20:05 +02:00
int res;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
KEY *key;
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
DBUG_ENTER("ha_ndbcluster::open");
DBUG_PRINT("enter", ("name: %s mode: %d test_if_locked: %d",
name, mode, test_if_locked));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
/*
Setup ref_length to make room for the whole
primary key to be written in the ref variable
*/
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
if (table->s->primary_key != MAX_KEY)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
key= table->key_info+table->s->primary_key;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ref_length= key->key_length;
DBUG_PRINT("info", (" ref_length: %d", ref_length));
}
// Init table lock structure
if (!(m_share=get_share(name)))
DBUG_RETURN(1);
thr_lock_data_init(&m_share->lock,&m_lock,(void*) 0);
set_dbname(name);
set_tabname(name);
if (check_ndb_connection()) {
free_share(&m_share);
m_share= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(HA_ERR_NO_CONNECTION);
}
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
2004-10-04 01:20:05 +02:00
res= get_metadata(name);
if (!res)
info(HA_STATUS_VARIABLE | HA_STATUS_CONST);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
2005-07-18 13:31:02 +02:00
2004-10-04 01:20:05 +02:00
DBUG_RETURN(res);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
void ha_ndbcluster::set_part_info(partition_info *part_info)
{
m_part_info= part_info;
if (!(m_part_info->part_type == HASH_PARTITION &&
m_part_info->list_of_part_fields &&
!is_sub_partitioned(m_part_info)))
m_use_partition_function= TRUE;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Close the table
- release resources setup by open()
*/
int ha_ndbcluster::close(void)
{
DBUG_ENTER("close");
free_share(&m_share);
m_share= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
release_metadata();
DBUG_RETURN(0);
}
Thd_ndb* ha_ndbcluster::seize_thd_ndb()
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Thd_ndb *thd_ndb;
DBUG_ENTER("seize_thd_ndb");
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
thd_ndb= new Thd_ndb();
thd_ndb->ndb->getDictionary()->set_local_table_data_size(
sizeof(Ndb_local_table_statistics)
);
if (thd_ndb->ndb->init(max_transactions) != 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
ERR_PRINT(thd_ndb->ndb->getNdbError());
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
TODO
Alt.1 If init fails because to many allocated Ndb
wait on condition for a Ndb object to be released.
Alt.2 Seize/release from pool, wait until next release
*/
delete thd_ndb;
thd_ndb= NULL;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
DBUG_RETURN(thd_ndb);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
void ha_ndbcluster::release_thd_ndb(Thd_ndb* thd_ndb)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_ENTER("release_thd_ndb");
delete thd_ndb;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_VOID_RETURN;
}
/*
If this thread already has a Thd_ndb object allocated
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
in current THD, reuse it. Otherwise
seize a Thd_ndb object, assign it to current THD and use it.
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
Ndb* check_ndb_in_thd(THD* thd)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Thd_ndb *thd_ndb= get_thd_ndb(thd);
if (!thd_ndb)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
if (!(thd_ndb= ha_ndbcluster::seize_thd_ndb()))
2005-02-11 22:33:52 +01:00
return NULL;
set_thd_ndb(thd, thd_ndb);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
2005-02-11 22:33:52 +01:00
return thd_ndb->ndb;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
}
int ha_ndbcluster::check_ndb_connection(THD* thd)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Ndb *ndb;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("check_ndb_connection");
if (!(ndb= check_ndb_in_thd(thd)))
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
DBUG_RETURN(HA_ERR_NO_CONNECTION);
ndb->setDatabaseName(m_dbname);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
int ndbcluster_close_connection(THD *thd)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
Thd_ndb *thd_ndb= get_thd_ndb(thd);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ndbcluster_close_connection");
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
if (thd_ndb)
{
ha_ndbcluster::release_thd_ndb(thd_ndb);
set_thd_ndb(thd, NULL); // not strictly required but does not hurt either
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
}
DBUG_RETURN(0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Try to discover one table from NDB
*/
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
int ndbcluster_discover(THD* thd, const char *db, const char *name,
const void** frmblob, uint* frmlen)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
uint len;
const void* data;
const NDBTAB* tab;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
Ndb* ndb;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ndbcluster_discover");
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (!(ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(HA_ERR_NO_CONNECTION);
ndb->setDatabaseName(db);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
NDBDICT* dict= ndb->getDictionary();
dict->set_local_table_data_size(sizeof(Ndb_local_table_statistics));
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
dict->invalidateTable(name);
if (!(tab= dict->getTable(name)))
{
const NdbError err= dict->getNdbError();
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
if (err.code == 709 || err.code == 723)
DBUG_RETURN(-1);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
ERR_RETURN(err);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
DBUG_PRINT("info", ("Found table %s", tab->getName()));
len= tab->getFrmLength();
if (len == 0 || tab->getFrmData() == NULL)
{
BUG#10365 Cluster handler uses non-standard error codes - Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table. - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine. mysql-test/r/ndb_autodiscover.result: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. mysql-test/t/ndb_autodiscover.test: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. ndb/test/ndbapi/create_tab.cpp: Set connectstring before creating Ndb object. sql/ha_ndbcluster.cc: Rename and use the function ndbcluster_table_exists_in_engine. Correct return valu from ndbcluster_discover Remove old code "ndb_discover_tables" sql/ha_ndbcluster.h: Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine sql/handler.cc: Update comment of ha_create_table_from_engine Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine. Cleanup return codes from ha_create_table_from_engine. Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes. sql/handler.h: Remove paramter create_if_cound from ha_create_table_from_engine Rename ha_table_exists to ha_table_exists_in_engine sql/sql_base.cc: Use the function ha_table_exists_in_engine to detect if table exists in enegine. If it exists, call function ha_create_table_from_engine to try and create it. If create of table fails, set correct error message. sql/sql_table.cc: Add comments, remove parameter create_if_found to ha_create_table_from_engine. When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists. Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed" When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
DBUG_PRINT("error", ("No frm data found."));
DBUG_RETURN(1);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
if (unpackfrm(&data, &len, tab->getFrmData()))
BUG#10365 Cluster handler uses non-standard error codes - Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table. - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine. mysql-test/r/ndb_autodiscover.result: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. mysql-test/t/ndb_autodiscover.test: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. ndb/test/ndbapi/create_tab.cpp: Set connectstring before creating Ndb object. sql/ha_ndbcluster.cc: Rename and use the function ndbcluster_table_exists_in_engine. Correct return valu from ndbcluster_discover Remove old code "ndb_discover_tables" sql/ha_ndbcluster.h: Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine sql/handler.cc: Update comment of ha_create_table_from_engine Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine. Cleanup return codes from ha_create_table_from_engine. Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes. sql/handler.h: Remove paramter create_if_cound from ha_create_table_from_engine Rename ha_table_exists to ha_table_exists_in_engine sql/sql_base.cc: Use the function ha_table_exists_in_engine to detect if table exists in enegine. If it exists, call function ha_create_table_from_engine to try and create it. If create of table fails, set correct error message. sql/sql_table.cc: Add comments, remove parameter create_if_found to ha_create_table_from_engine. When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists. Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed" When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
{
DBUG_PRINT("error", ("Could not unpack table"));
DBUG_RETURN(1);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*frmlen= len;
*frmblob= data;
DBUG_RETURN(0);
}
/*
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
Check if a table exists in NDB
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
*/
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
BUG#10365 Cluster handler uses non-standard error codes - Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table. - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine. mysql-test/r/ndb_autodiscover.result: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. mysql-test/t/ndb_autodiscover.test: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. ndb/test/ndbapi/create_tab.cpp: Set connectstring before creating Ndb object. sql/ha_ndbcluster.cc: Rename and use the function ndbcluster_table_exists_in_engine. Correct return valu from ndbcluster_discover Remove old code "ndb_discover_tables" sql/ha_ndbcluster.h: Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine sql/handler.cc: Update comment of ha_create_table_from_engine Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine. Cleanup return codes from ha_create_table_from_engine. Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes. sql/handler.h: Remove paramter create_if_cound from ha_create_table_from_engine Rename ha_table_exists to ha_table_exists_in_engine sql/sql_base.cc: Use the function ha_table_exists_in_engine to detect if table exists in enegine. If it exists, call function ha_create_table_from_engine to try and create it. If create of table fails, set correct error message. sql/sql_table.cc: Add comments, remove parameter create_if_found to ha_create_table_from_engine. When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists. Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed" When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
int ndbcluster_table_exists_in_engine(THD* thd, const char *db, const char *name)
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
{
const NDBTAB* tab;
Ndb* ndb;
BUG#10365 Cluster handler uses non-standard error codes - Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table. - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine. mysql-test/r/ndb_autodiscover.result: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. mysql-test/t/ndb_autodiscover.test: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. ndb/test/ndbapi/create_tab.cpp: Set connectstring before creating Ndb object. sql/ha_ndbcluster.cc: Rename and use the function ndbcluster_table_exists_in_engine. Correct return valu from ndbcluster_discover Remove old code "ndb_discover_tables" sql/ha_ndbcluster.h: Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine sql/handler.cc: Update comment of ha_create_table_from_engine Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine. Cleanup return codes from ha_create_table_from_engine. Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes. sql/handler.h: Remove paramter create_if_cound from ha_create_table_from_engine Rename ha_table_exists to ha_table_exists_in_engine sql/sql_base.cc: Use the function ha_table_exists_in_engine to detect if table exists in enegine. If it exists, call function ha_create_table_from_engine to try and create it. If create of table fails, set correct error message. sql/sql_table.cc: Add comments, remove parameter create_if_found to ha_create_table_from_engine. When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists. Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed" When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
DBUG_ENTER("ndbcluster_table_exists_in_engine");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (!(ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(HA_ERR_NO_CONNECTION);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
ndb->setDatabaseName(db);
NDBDICT* dict= ndb->getDictionary();
dict->set_local_table_data_size(sizeof(Ndb_local_table_statistics));
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
dict->invalidateTable(name);
if (!(tab= dict->getTable(name)))
{
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
const NdbError err= dict->getNdbError();
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
if (err.code == 709 || err.code == 723)
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
DBUG_RETURN(0);
ERR_RETURN(err);
}
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
DBUG_PRINT("info", ("Found table %s", tab->getName()));
DBUG_RETURN(1);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
extern "C" byte* tables_get_key(const char *entry, uint *length,
my_bool not_used __attribute__((unused)))
{
*length= strlen(entry);
return (byte*) entry;
}
/*
Drop a database in NDB Cluster
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
NOTE add a dummy void function, since stupid handlerton is returning void instead of int...
*/
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
int ndbcluster_drop_database_impl(const char *path)
{
DBUG_ENTER("ndbcluster_drop_database");
THD *thd= current_thd;
char dbname[FN_HEADLEN];
Ndb* ndb;
NdbDictionary::Dictionary::List list;
uint i;
char *tabname;
List<char> drop_list;
int ret= 0;
ha_ndbcluster::set_dbname(path, (char *)&dbname);
DBUG_PRINT("enter", ("db: %s", dbname));
if (!(ndb= check_ndb_in_thd(thd)))
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
DBUG_RETURN(-1);
// List tables in NDB
NDBDICT *dict= ndb->getDictionary();
if (dict->listObjects(list,
NdbDictionary::Object::UserTable) != 0)
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
DBUG_RETURN(-1);
for (i= 0 ; i < list.count ; i++)
{
NdbDictionary::Dictionary::List::Element& elmt= list.elements[i];
DBUG_PRINT("info", ("Found %s/%s in NDB", elmt.database, elmt.name));
// Add only tables that belongs to db
if (my_strcasecmp(system_charset_info, elmt.database, dbname))
continue;
DBUG_PRINT("info", ("%s must be dropped", elmt.name));
drop_list.push_back(thd->strdup(elmt.name));
}
// Drop any tables belonging to database
char full_path[FN_REFLEN];
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
char *tmp= strxnmov(full_path, FN_REFLEN-1, share_prefix, dbname, "/",
NullS);
ndb->setDatabaseName(dbname);
List_iterator_fast<char> it(drop_list);
while ((tabname=it++))
{
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
strxnmov(tmp, FN_REFLEN - (tmp - full_path)-1, tabname, NullS);
if (ha_ndbcluster::delete_table(0, ndb, full_path, dbname, tabname))
{
const NdbError err= dict->getNdbError();
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
if (err.code != 709 && err.code != 723)
{
ERR_PRINT(err);
ret= ndb_to_mysql_error(&err);
}
}
}
DBUG_RETURN(ret);
}
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
void ndbcluster_drop_database(char *path)
{
ndbcluster_drop_database_impl(path);
}
/*
find all tables in ndb and discover those needed
*/
static int ndbcluster_find_all_files(THD *thd)
{
DBUG_ENTER("ndbcluster_find_all_files");
Ndb* ndb;
char key[FN_REFLEN];
NdbDictionary::Dictionary::List list;
if (!(ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(HA_ERR_NO_CONNECTION);
NDBDICT *dict= ndb->getDictionary();
int unhandled, retries= 5;
do
{
if (dict->listObjects(list, NdbDictionary::Object::UserTable) != 0)
ERR_RETURN(dict->getNdbError());
unhandled= 0;
for (uint i= 0 ; i < list.count ; i++)
{
NDBDICT::List::Element& elmt= list.elements[i];
DBUG_PRINT("info", ("Found %s.%s in NDB", elmt.database, elmt.name));
if (!(elmt.state == NDBOBJ::StateBuilding ||
elmt.state == NDBOBJ::StateOnline))
{
sql_print_information("NDB: skipping setup table %s.%s, in state %d",
elmt.database, elmt.name, elmt.state);
continue;
}
ndb->setDatabaseName(elmt.database);
const NDBTAB *ndbtab;
if (!(ndbtab= dict->getTable(elmt.name)))
{
sql_print_error("NDB: failed to setup table %s.%s, error: %d, %s",
elmt.database, elmt.name,
dict->getNdbError().code,
dict->getNdbError().message);
unhandled++;
continue;
}
if (ndbtab->getFrmLength() == 0)
continue;
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
strxnmov(key, FN_LEN-1, mysql_data_home, "/",
elmt.database, "/", elmt.name, NullS);
const void *data= 0, *pack_data= 0;
uint length, pack_length;
int discover= 0;
if (readfrm(key, &data, &length) ||
packfrm(data, length, &pack_data, &pack_length))
{
discover= 1;
sql_print_information("NDB: missing frm for %s.%s, discovering...",
elmt.database, elmt.name);
}
else if (cmp_frm(ndbtab, pack_data, pack_length))
{
discover= 1;
sql_print_information("NDB: mismatch in frm for %s.%s, discovering...",
elmt.database, elmt.name);
}
my_free((char*) data, MYF(MY_ALLOW_ZERO_PTR));
my_free((char*) pack_data, MYF(MY_ALLOW_ZERO_PTR));
if (discover)
{
/* ToDo 4.1 database needs to be created if missing */
pthread_mutex_lock(&LOCK_open);
if (ha_create_table_from_engine(thd, elmt.database, elmt.name))
{
/* ToDo 4.1 handle error */
}
pthread_mutex_unlock(&LOCK_open);
}
}
}
while (unhandled && retries--);
DBUG_RETURN(0);
}
int ndbcluster_find_files(THD *thd,const char *db,const char *path,
const char *wild, bool dir, List<char> *files)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_ENTER("ndbcluster_find_files");
DBUG_PRINT("enter", ("db: %s", db));
{ // extra bracket to avoid gcc 2.95.3 warning
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
uint i;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
Ndb* ndb;
char name[FN_REFLEN];
HASH ndb_tables, ok_tables;
NDBDICT::List list;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (!(ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(HA_ERR_NO_CONNECTION);
if (dir)
DBUG_RETURN(0); // Discover of databases not yet supported
// List tables in NDB
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
NDBDICT *dict= ndb->getDictionary();
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (dict->listObjects(list,
NdbDictionary::Object::UserTable) != 0)
ERR_RETURN(dict->getNdbError());
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if (hash_init(&ndb_tables, system_charset_info,list.count,0,0,
(hash_get_key)tables_get_key,0,0))
{
DBUG_PRINT("error", ("Failed to init HASH ndb_tables"));
DBUG_RETURN(-1);
}
if (hash_init(&ok_tables, system_charset_info,32,0,0,
(hash_get_key)tables_get_key,0,0))
{
DBUG_PRINT("error", ("Failed to init HASH ok_tables"));
hash_free(&ndb_tables);
DBUG_RETURN(-1);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
for (i= 0 ; i < list.count ; i++)
{
NDBDICT::List::Element& elmt= list.elements[i];
DBUG_PRINT("info", ("Found %s/%s in NDB", elmt.database, elmt.name));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Add only tables that belongs to db
if (my_strcasecmp(system_charset_info, elmt.database, db))
continue;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Apply wildcard to list of tables in NDB
if (wild)
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
{
if (lower_case_table_names)
{
if (wild_case_compare(files_charset_info, elmt.name, wild))
continue;
}
else if (wild_compare(elmt.name,wild,0))
continue;
}
DBUG_PRINT("info", ("Inserting %s into ndb_tables hash", elmt.name));
my_hash_insert(&ndb_tables, (byte*)thd->strdup(elmt.name));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
char *file_name;
List_iterator<char> it(*files);
List<char> delete_list;
while ((file_name=it++))
{
DBUG_PRINT("info", ("%s", file_name));
if (hash_search(&ndb_tables, file_name, strlen(file_name)))
{
DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name));
// File existed in NDB and as frm file, put in ok_tables list
my_hash_insert(&ok_tables, (byte*)file_name);
continue;
}
// File is not in NDB, check for .ndb file with this name
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
(void)strxnmov(name, FN_REFLEN-1,
mysql_data_home,"/",db,"/",file_name,ha_ndb_ext,NullS);
DBUG_PRINT("info", ("Check access for %s", name));
if (access(name, F_OK))
{
DBUG_PRINT("info", ("%s did not exist on disk", name));
// .ndb file did not exist on disk, another table type
continue;
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
}
DBUG_PRINT("info", ("%s existed on disk", name));
// The .ndb file exists on disk, but it's not in list of tables in ndb
// Verify that handler agrees table is gone.
BUG#10365 Cluster handler uses non-standard error codes - Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table. - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine. mysql-test/r/ndb_autodiscover.result: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. mysql-test/t/ndb_autodiscover.test: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. ndb/test/ndbapi/create_tab.cpp: Set connectstring before creating Ndb object. sql/ha_ndbcluster.cc: Rename and use the function ndbcluster_table_exists_in_engine. Correct return valu from ndbcluster_discover Remove old code "ndb_discover_tables" sql/ha_ndbcluster.h: Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine sql/handler.cc: Update comment of ha_create_table_from_engine Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine. Cleanup return codes from ha_create_table_from_engine. Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes. sql/handler.h: Remove paramter create_if_cound from ha_create_table_from_engine Rename ha_table_exists to ha_table_exists_in_engine sql/sql_base.cc: Use the function ha_table_exists_in_engine to detect if table exists in enegine. If it exists, call function ha_create_table_from_engine to try and create it. If create of table fails, set correct error message. sql/sql_table.cc: Add comments, remove parameter create_if_found to ha_create_table_from_engine. When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists. Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed" When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
if (ndbcluster_table_exists_in_engine(thd, db, file_name) == 0)
{
DBUG_PRINT("info", ("NDB says %s does not exists", file_name));
it.remove();
// Put in list of tables to remove from disk
delete_list.push_back(thd->strdup(file_name));
}
}
// Check for new files to discover
DBUG_PRINT("info", ("Checking for new files to discover"));
List<char> create_list;
for (i= 0 ; i < ndb_tables.records ; i++)
{
file_name= hash_element(&ndb_tables, i);
if (!hash_search(&ok_tables, file_name, strlen(file_name)))
{
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
strxnmov(name, sizeof(name)-1,
mysql_data_home, "/", db, "/", file_name, reg_ext, NullS);
if (access(name, F_OK))
{
DBUG_PRINT("info", ("%s must be discovered", file_name));
// File is in list of ndb tables and not in ok_tables
// This table need to be created
create_list.push_back(thd->strdup(file_name));
}
}
}
// Lock mutex before deleting and creating frm files
pthread_mutex_lock(&LOCK_open);
if (!global_read_lock)
{
// Delete old files
List_iterator_fast<char> it3(delete_list);
while ((file_name=it3++))
{
DBUG_PRINT("info", ("Remove table %s/%s", db, file_name));
// Delete the table and all related files
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
table_list.db= (char*) db;
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
table_list.alias= table_list.table_name= (char*)file_name;
(void)mysql_rm_table_part2(thd, &table_list,
/* if_exists */ FALSE,
/* drop_temporary */ FALSE,
/* drop_view */ FALSE,
/* dont_log_query*/ TRUE);
/* Clear error message that is returned when table is deleted */
thd->clear_error();
}
}
// Create new files
List_iterator_fast<char> it2(create_list);
while ((file_name=it2++))
{
BUG#9626 Several serious errors reported by Valgrind in latest 5.0 bk tree - Fix several valgrind warnings. ndb/include/kernel/AttributeList.hpp: Include ndb_limits.h ndb/include/ndbapi/Ndb.hpp: Add new function internalize_table_name Proper formatting ndb/include/util/SimpleProperties.hpp: Add function "add" for adding strings/data to word buffers without reading after the string/data Fix comment for UtilBufferWriter ndb/src/common/util/SimpleProperties.cpp: Add function "add" for adding strings/data to word buffers without reading after the string/data ndb/src/ndbapi/DictCache.cpp: Add DBUG printouts to all functions in GlobalDictCache Change ndbout_c to DBUG_PRINT Add function GlobalDictCache::printCache ndb/src/ndbapi/DictCache.hpp: Add function GlobalDictCache::printCache ndb/src/ndbapi/Ndb.cpp: Change DEBUG_TRACE to DBUG_PRINT, DBUG_ENTER Use new function internalize_table_name, and create internal tabname on stack ndb/src/ndbapi/NdbDictionary.cpp: Add DBUG_ENTER calls ndb/src/ndbapi/NdbDictionaryImpl.cpp: Pass BaseString as reference when passing internal table name to internal functions. Remove check for exceeding MAX_SECTION_SIZE. Remove pekkas fix that saves internalName in save_me variable, not needed when tablename is stack variable. NdbDictInterface::gettable(int tableid, ...) - Not used ndb/src/ndbapi/NdbDictionaryImpl.hpp: Remove include of ndb_limits.h Use BaseString& for internal functions Remove m_namebuf, not needed, uses m_buffer Formatting NdbDictInterface::getTable(int tableId, ...) - Not used ndb/src/ndbapi/NdbImpl.hpp: Remove buffer for m_internalname, placed on stack of caller. Moved impl of internalize_table_name and internalize_index_anme to Ndb::internalize_table_name and Ndb::internalize_index_name ndb/src/ndbapi/NdbLinHash.hpp: Save also the terminating null character in chain->str to get nicer printouts. ndb/src/ndbapi/NdbTransaction.cpp: Remove hardcoded buffer sizes. Remove include of ndb_limits.h sql/ha_ndbcluster.cc: Fix "typo", use file_name var since that is the current files name,
2005-06-02 14:32:06 +02:00
DBUG_PRINT("info", ("Table %s need discovery", file_name));
BUG#10365 Cluster handler uses non-standard error codes - Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table. - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine. mysql-test/r/ndb_autodiscover.result: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. mysql-test/t/ndb_autodiscover.test: Add tests for reading from a table that can't be discovered(SYSTAB_0) Discovery is not performed during create table anymore. ndb/test/ndbapi/create_tab.cpp: Set connectstring before creating Ndb object. sql/ha_ndbcluster.cc: Rename and use the function ndbcluster_table_exists_in_engine. Correct return valu from ndbcluster_discover Remove old code "ndb_discover_tables" sql/ha_ndbcluster.h: Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine sql/handler.cc: Update comment of ha_create_table_from_engine Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine. Cleanup return codes from ha_create_table_from_engine. Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes. sql/handler.h: Remove paramter create_if_cound from ha_create_table_from_engine Rename ha_table_exists to ha_table_exists_in_engine sql/sql_base.cc: Use the function ha_table_exists_in_engine to detect if table exists in enegine. If it exists, call function ha_create_table_from_engine to try and create it. If create of table fails, set correct error message. sql/sql_table.cc: Add comments, remove parameter create_if_found to ha_create_table_from_engine. When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists. Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed" When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
if (ha_create_table_from_engine(thd, db, file_name) == 0)
files->push_back(thd->strdup(file_name));
}
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
pthread_mutex_unlock(&LOCK_open);
hash_free(&ok_tables);
hash_free(&ndb_tables);
} // extra bracket to avoid gcc 2.95.3 warning
DBUG_RETURN(0);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Initialise all gloal variables before creating
a NDB Cluster table handler
*/
/* Call back after cluster connect */
static int connect_callback()
{
update_status_variables(g_ndb_cluster_connection);
pthread_cond_signal(&COND_ndb_util_thread);
return 0;
}
Next big patch for loadable storage engines! Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types
2005-10-03 04:44:28 +02:00
bool ndbcluster_init()
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int res;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("ndbcluster_init");
Next big patch for loadable storage engines! Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types
2005-10-03 04:44:28 +02:00
if (have_ndbcluster != SHOW_OPTION_YES)
goto ndbcluster_init_error;
// Set connectstring if specified
added config parameter Group on connection moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection moved all private things to impl class added opts for shared memory and node selection changed opts handling somewhat; introduced enum for options and common handling of option variables added checks for transporter support automatic addition of shared mem transporters moved wait_until_ready code to cluster connection added control of usage of new node selection method ndb/include/mgmapi/mgmapi_config_parameters.h: added config parameter Group on connection ndb/include/ndbapi/Ndb.hpp: moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection ndb/include/ndbapi/ndb_cluster_connection.hpp: moved all private things to impl class ndb/include/util/ndb_opts.h: added opts for shared memory and node selection ndb/src/kernel/vm/Configuration.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmclient/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmsrv/ConfigInfo.cpp: added checks for transporter support automatic addition of shared mem transporters ndb/src/mgmsrv/MgmtSrvr.cpp: in alloc node id first choose connection with specified hostname ndb/src/mgmsrv/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/ndbapi/DictCache.hpp: added include file ndb/src/ndbapi/Ndb.cpp: enabled using new node selection method moved wait_until_ready code to cluster connection moved node selection (hint) to cluster connection removed start transaction dgroup ndb/src/ndbapi/NdbDictionaryImpl.hpp: removed and added inclusde files ndb/src/ndbapi/NdbImpl.hpp: moved things from Ndb into Impl class moved waiter things to new file NdbWaiter.hpp ndb/src/ndbapi/NdbScanOperation.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbif.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbinit.cpp: moved some Ndb things into impl class ndb/src/ndbapi/TransporterFacade.hpp: changed friend declaration ndb/src/ndbapi/ndb_cluster_connection.cpp: moved node selection things to cluster connection moved things from cluster connection to cluster connection impl class ndb/test/ndbapi/testNdbApi.cpp: removed start transaction dgroup ndb/tools/delete_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/desc.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_index.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_tab.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/listTables.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/restore/restore_main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_count.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/waiter.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables sql/ha_ndbcluster.cc: added control of usage of new node selection method sql/mysqld.cc: added control of usage of new node selection method
2004-12-20 12:36:14 +01:00
if (opt_ndbcluster_connectstring != 0)
DBUG_PRINT("connectstring", ("%s", opt_ndbcluster_connectstring));
if ((g_ndb_cluster_connection=
added config parameter Group on connection moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection moved all private things to impl class added opts for shared memory and node selection changed opts handling somewhat; introduced enum for options and common handling of option variables added checks for transporter support automatic addition of shared mem transporters moved wait_until_ready code to cluster connection added control of usage of new node selection method ndb/include/mgmapi/mgmapi_config_parameters.h: added config parameter Group on connection ndb/include/ndbapi/Ndb.hpp: moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection ndb/include/ndbapi/ndb_cluster_connection.hpp: moved all private things to impl class ndb/include/util/ndb_opts.h: added opts for shared memory and node selection ndb/src/kernel/vm/Configuration.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmclient/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmsrv/ConfigInfo.cpp: added checks for transporter support automatic addition of shared mem transporters ndb/src/mgmsrv/MgmtSrvr.cpp: in alloc node id first choose connection with specified hostname ndb/src/mgmsrv/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/ndbapi/DictCache.hpp: added include file ndb/src/ndbapi/Ndb.cpp: enabled using new node selection method moved wait_until_ready code to cluster connection moved node selection (hint) to cluster connection removed start transaction dgroup ndb/src/ndbapi/NdbDictionaryImpl.hpp: removed and added inclusde files ndb/src/ndbapi/NdbImpl.hpp: moved things from Ndb into Impl class moved waiter things to new file NdbWaiter.hpp ndb/src/ndbapi/NdbScanOperation.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbif.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbinit.cpp: moved some Ndb things into impl class ndb/src/ndbapi/TransporterFacade.hpp: changed friend declaration ndb/src/ndbapi/ndb_cluster_connection.cpp: moved node selection things to cluster connection moved things from cluster connection to cluster connection impl class ndb/test/ndbapi/testNdbApi.cpp: removed start transaction dgroup ndb/tools/delete_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/desc.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_index.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_tab.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/listTables.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/restore/restore_main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_count.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/waiter.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables sql/ha_ndbcluster.cc: added control of usage of new node selection method sql/mysqld.cc: added control of usage of new node selection method
2004-12-20 12:36:14 +01:00
new Ndb_cluster_connection(opt_ndbcluster_connectstring)) == 0)
{
added config parameter Group on connection moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection moved all private things to impl class added opts for shared memory and node selection changed opts handling somewhat; introduced enum for options and common handling of option variables added checks for transporter support automatic addition of shared mem transporters moved wait_until_ready code to cluster connection added control of usage of new node selection method ndb/include/mgmapi/mgmapi_config_parameters.h: added config parameter Group on connection ndb/include/ndbapi/Ndb.hpp: moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection ndb/include/ndbapi/ndb_cluster_connection.hpp: moved all private things to impl class ndb/include/util/ndb_opts.h: added opts for shared memory and node selection ndb/src/kernel/vm/Configuration.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmclient/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmsrv/ConfigInfo.cpp: added checks for transporter support automatic addition of shared mem transporters ndb/src/mgmsrv/MgmtSrvr.cpp: in alloc node id first choose connection with specified hostname ndb/src/mgmsrv/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/ndbapi/DictCache.hpp: added include file ndb/src/ndbapi/Ndb.cpp: enabled using new node selection method moved wait_until_ready code to cluster connection moved node selection (hint) to cluster connection removed start transaction dgroup ndb/src/ndbapi/NdbDictionaryImpl.hpp: removed and added inclusde files ndb/src/ndbapi/NdbImpl.hpp: moved things from Ndb into Impl class moved waiter things to new file NdbWaiter.hpp ndb/src/ndbapi/NdbScanOperation.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbif.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbinit.cpp: moved some Ndb things into impl class ndb/src/ndbapi/TransporterFacade.hpp: changed friend declaration ndb/src/ndbapi/ndb_cluster_connection.cpp: moved node selection things to cluster connection moved things from cluster connection to cluster connection impl class ndb/test/ndbapi/testNdbApi.cpp: removed start transaction dgroup ndb/tools/delete_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/desc.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_index.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_tab.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/listTables.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/restore/restore_main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_count.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/waiter.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables sql/ha_ndbcluster.cc: added control of usage of new node selection method sql/mysqld.cc: added control of usage of new node selection method
2004-12-20 12:36:14 +01:00
DBUG_PRINT("error",("Ndb_cluster_connection(%s)",
opt_ndbcluster_connectstring));
goto ndbcluster_init_error;
}
added config parameter Group on connection moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection moved all private things to impl class added opts for shared memory and node selection changed opts handling somewhat; introduced enum for options and common handling of option variables added checks for transporter support automatic addition of shared mem transporters moved wait_until_ready code to cluster connection added control of usage of new node selection method ndb/include/mgmapi/mgmapi_config_parameters.h: added config parameter Group on connection ndb/include/ndbapi/Ndb.hpp: moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection ndb/include/ndbapi/ndb_cluster_connection.hpp: moved all private things to impl class ndb/include/util/ndb_opts.h: added opts for shared memory and node selection ndb/src/kernel/vm/Configuration.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmclient/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmsrv/ConfigInfo.cpp: added checks for transporter support automatic addition of shared mem transporters ndb/src/mgmsrv/MgmtSrvr.cpp: in alloc node id first choose connection with specified hostname ndb/src/mgmsrv/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/ndbapi/DictCache.hpp: added include file ndb/src/ndbapi/Ndb.cpp: enabled using new node selection method moved wait_until_ready code to cluster connection moved node selection (hint) to cluster connection removed start transaction dgroup ndb/src/ndbapi/NdbDictionaryImpl.hpp: removed and added inclusde files ndb/src/ndbapi/NdbImpl.hpp: moved things from Ndb into Impl class moved waiter things to new file NdbWaiter.hpp ndb/src/ndbapi/NdbScanOperation.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbif.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbinit.cpp: moved some Ndb things into impl class ndb/src/ndbapi/TransporterFacade.hpp: changed friend declaration ndb/src/ndbapi/ndb_cluster_connection.cpp: moved node selection things to cluster connection moved things from cluster connection to cluster connection impl class ndb/test/ndbapi/testNdbApi.cpp: removed start transaction dgroup ndb/tools/delete_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/desc.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_index.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_tab.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/listTables.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/restore/restore_main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_count.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/waiter.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables sql/ha_ndbcluster.cc: added control of usage of new node selection method sql/mysqld.cc: added control of usage of new node selection method
2004-12-20 12:36:14 +01:00
g_ndb_cluster_connection->set_optimized_node_selection
(opt_ndb_optimized_node_selection);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
// Create a Ndb object to open the connection to NDB
if ( (g_ndb= new Ndb(g_ndb_cluster_connection, "sys")) == 0 )
{
DBUG_PRINT("error", ("failed to create global ndb object"));
goto ndbcluster_init_error;
}
g_ndb->getDictionary()->set_local_table_data_size(sizeof(Ndb_local_table_statistics));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (g_ndb->init() != 0)
{
ERR_PRINT (g_ndb->getNdbError());
goto ndbcluster_init_error;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
if ((res= g_ndb_cluster_connection->connect(0,0,0)) == 0)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
connect_callback();
DBUG_PRINT("info",("NDBCLUSTER storage engine at %s on port %d",
g_ndb_cluster_connection->get_connected_host(),
g_ndb_cluster_connection->get_connected_port()));
g_ndb_cluster_connection->wait_until_ready(10,3);
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
else if (res == 1)
{
if (g_ndb_cluster_connection->start_connect_thread(connect_callback))
{
DBUG_PRINT("error", ("g_ndb_cluster_connection->start_connect_thread()"));
goto ndbcluster_init_error;
}
#ifndef DBUG_OFF
{
char buf[1024];
DBUG_PRINT("info",
("NDBCLUSTER storage engine not started, "
"will connect using %s",
g_ndb_cluster_connection->
get_connectstring(buf,sizeof(buf))));
}
#endif
}
else
{
DBUG_ASSERT(res == -1);
DBUG_PRINT("error", ("permanent error"));
goto ndbcluster_init_error;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
(void) hash_init(&ndbcluster_open_tables,system_charset_info,32,0,0,
(hash_get_key) ndbcluster_get_key,0,0);
pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
2005-02-11 22:33:52 +01:00
pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_ndb_util_thread, NULL);
moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization new methods to keep "records" up to datecorrect record field in ndbcluster handler new method for ndbcluster handler to store/retrieve table and thread specific data changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl hanged deleteKey to return ponter to deleted object moved heavy global cache fetch from inline to separate method mysql-test/r/ndb_alter_table.result: correct record field in ndbcluster handler mysql-test/r/ndb_blob.result: correct record field in ndbcluster handler ndb/include/ndbapi/NdbDictionary.hpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/DictCache.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/DictCache.hpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl ndb/src/ndbapi/Ndb.cpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbDictionary.cpp: new method for ndbcluster handler to store/retrieve table and thread specific data ndb/src/ndbapi/NdbDictionaryImpl.cpp: changed local hash to store new table_info object, with placeholders for local data, instead of TableImpl moved heavy global cache fetch from inline to separate method ndb/src/ndbapi/NdbDictionaryImpl.hpp: replaced method DictionaryImpl::getTable with DictionaryImpl::get_local_table_info ndb/src/ndbapi/NdbLinHash.hpp: changed deleteKey to return ponter to deleted object sql/ha_ndbcluster.cc: moved all ndb thread specific data into new placeholder new methods to keep "records" up to date unset flag HA_NOT_EXACT_COUNT to make handler read "records" field, for count() optim and join optimization sql/ha_ndbcluster.h: new methods to keep "records" up to date sql/sql_class.h: moved all ndb thread specific data into new placeholder
2004-09-14 10:52:21 +02:00
2005-02-11 22:33:52 +01:00
// Create utility thread
pthread_t tmp;
if (pthread_create(&tmp, &connection_attrib, ndb_util_thread_func, 0))
{
DBUG_PRINT("error", ("Could not create ndb utility thread"));
hash_free(&ndbcluster_open_tables);
pthread_mutex_destroy(&ndbcluster_mutex);
pthread_mutex_destroy(&LOCK_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_thread);
2005-02-11 22:33:52 +01:00
goto ndbcluster_init_error;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ndbcluster_inited= 1;
Next big patch for loadable storage engines! Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types
2005-10-03 04:44:28 +02:00
DBUG_RETURN(FALSE);
2005-02-11 22:33:52 +01:00
Next big patch for loadable storage engines! Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types
2005-10-03 04:44:28 +02:00
ndbcluster_init_error:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (g_ndb)
delete g_ndb;
g_ndb= NULL;
if (g_ndb_cluster_connection)
delete g_ndb_cluster_connection;
g_ndb_cluster_connection= NULL;
Next big patch for loadable storage engines! Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types
2005-10-03 04:44:28 +02:00
have_ndbcluster= SHOW_OPTION_DISABLED; // If we couldn't use handler
DBUG_RETURN(TRUE);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
End use of the NDB Cluster table handler
- free all global variables allocated by
2005-02-11 22:33:52 +01:00
ndbcluster_init()
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
int ndbcluster_end(ha_panic_function type)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
DBUG_ENTER("ndbcluster_end");
2005-02-11 22:33:52 +01:00
if (!ndbcluster_inited)
DBUG_RETURN(0);
2005-02-11 22:33:52 +01:00
// Kill ndb utility thread
(void) pthread_mutex_lock(&LOCK_ndb_util_thread);
DBUG_PRINT("exit",("killing ndb util thread: %lx", ndb_util_thread));
(void) pthread_cond_signal(&COND_ndb_util_thread);
(void) pthread_mutex_unlock(&LOCK_ndb_util_thread);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (g_ndb)
{
#ifndef DBUG_OFF
Review fixes of new pushed code - Fixed tests - Optimized new code - Fixed some unlikely core dumps - Better bug fixes for: - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null mysql-test/r/create.result: Update results after removing wrong warnings for CREATE ... SELECT New tests mysql-test/r/handler.result: Drop used tables mysql-test/r/kill.result: Make test portable mysql-test/r/mysqlshow.result: Drop tables used by previous test mysql-test/r/trigger.result: Reuse old procedure name mysql-test/r/view.result: Extra tests mysql-test/t/create.test: New tests to test fix of removing wrong warnings for CREATE ... SELECT mysql-test/t/disabled.def: Enable 'kill' test (should now be portable) mysql-test/t/handler.test: Drop used tables mysql-test/t/kill.test: Make test portable even if kill doesn't work at once mysql-test/t/mysqlshow.test: Drop tables used by previous test mysql-test/t/trigger.test: Reuse old procedure name mysql-test/t/view.test: Extra tests sql/field.cc: Removed compiler warning sql/ha_federated.cc: my_snprintf -> strmake() (Simple optimization) sql/ha_ndbcluster.cc: Indentation cleanups and trival optimization sql/item.cc: Moved save_org_in_field() to item.cc to make it easier to test Remove setting of null_value as this is not needed sql/item.h: Moved save_org_in_field() to item.cc to make it easier to test sql/log_event.cc: Remove inline of slave_load_file_stem() Added 'extension' parameter to slave_load_file_stem() to get smaller code Removed not critical (or needed) DBUG_ASSERT()'s Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths Indentation fixes sql/opt_range.cc: Moved code from declaration to function body (To make it more readable) sql/parse_file.cc: Fixed DBUG_PRINT sql/sp.cc: Simple cleanups - Removed not needed {} level - Ensure saved variables starts with old_ sql/sp_head.cc: Indentation fixes Remove core dump when using --debug when m_next_cached_sp == 0 Fixed compiler warnings Trivial optimizations sql/sp_head.h: Changed argument to set_definer() to const Added THD argument to recursion_level_error() to avoid call to current_thd sql/sql_acl.cc: Removed not needed test (first_not_own_table is the guard) sql/sql_base.cc: Removed extra empty line sql/sql_handler.cc: Don't test table version in mysql_ha_read() as this is already tested in lock_tables() Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables (Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash) sql/sql_insert.cc: Mark fields that are set in CREATE ... SELECT as used (Removed wrong warnings about field not having a default value) sql/sql_parse.cc: Removed not needed test of 'tables' (first_not_own_table is the guard) Simplify code sql/sql_select.cc: Use group->field to check if value is null instead of item called by 'save_org_in_field' This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null) sql/sql_trigger.cc: Move sql_modes_parameters outside of function Indentation fixes Fixed compiler warning Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access() (This allows us to remove the extra test in check_grant() and check_table_access())
2006-01-05 23:47:49 +01:00
Ndb::Free_list_usage tmp;
tmp.m_name= 0;
while (g_ndb->get_free_list_usage(&tmp))
{
uint leaked= (uint) tmp.m_created - tmp.m_free;
if (leaked)
fprintf(stderr, "NDB: Found %u %s%s that %s not been released\n",
leaked, tmp.m_name,
(leaked == 1)?"":"'s",
(leaked == 1)?"has":"have");
}
#endif
delete g_ndb;
Review fixes of new pushed code - Fixed tests - Optimized new code - Fixed some unlikely core dumps - Better bug fixes for: - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null mysql-test/r/create.result: Update results after removing wrong warnings for CREATE ... SELECT New tests mysql-test/r/handler.result: Drop used tables mysql-test/r/kill.result: Make test portable mysql-test/r/mysqlshow.result: Drop tables used by previous test mysql-test/r/trigger.result: Reuse old procedure name mysql-test/r/view.result: Extra tests mysql-test/t/create.test: New tests to test fix of removing wrong warnings for CREATE ... SELECT mysql-test/t/disabled.def: Enable 'kill' test (should now be portable) mysql-test/t/handler.test: Drop used tables mysql-test/t/kill.test: Make test portable even if kill doesn't work at once mysql-test/t/mysqlshow.test: Drop tables used by previous test mysql-test/t/trigger.test: Reuse old procedure name mysql-test/t/view.test: Extra tests sql/field.cc: Removed compiler warning sql/ha_federated.cc: my_snprintf -> strmake() (Simple optimization) sql/ha_ndbcluster.cc: Indentation cleanups and trival optimization sql/item.cc: Moved save_org_in_field() to item.cc to make it easier to test Remove setting of null_value as this is not needed sql/item.h: Moved save_org_in_field() to item.cc to make it easier to test sql/log_event.cc: Remove inline of slave_load_file_stem() Added 'extension' parameter to slave_load_file_stem() to get smaller code Removed not critical (or needed) DBUG_ASSERT()'s Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths Indentation fixes sql/opt_range.cc: Moved code from declaration to function body (To make it more readable) sql/parse_file.cc: Fixed DBUG_PRINT sql/sp.cc: Simple cleanups - Removed not needed {} level - Ensure saved variables starts with old_ sql/sp_head.cc: Indentation fixes Remove core dump when using --debug when m_next_cached_sp == 0 Fixed compiler warnings Trivial optimizations sql/sp_head.h: Changed argument to set_definer() to const Added THD argument to recursion_level_error() to avoid call to current_thd sql/sql_acl.cc: Removed not needed test (first_not_own_table is the guard) sql/sql_base.cc: Removed extra empty line sql/sql_handler.cc: Don't test table version in mysql_ha_read() as this is already tested in lock_tables() Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables (Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash) sql/sql_insert.cc: Mark fields that are set in CREATE ... SELECT as used (Removed wrong warnings about field not having a default value) sql/sql_parse.cc: Removed not needed test of 'tables' (first_not_own_table is the guard) Simplify code sql/sql_select.cc: Use group->field to check if value is null instead of item called by 'save_org_in_field' This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null) sql/sql_trigger.cc: Move sql_modes_parameters outside of function Indentation fixes Fixed compiler warning Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access() (This allows us to remove the extra test in check_grant() and check_table_access())
2006-01-05 23:47:49 +01:00
g_ndb= NULL;
}
Review fixes of new pushed code - Fixed tests - Optimized new code - Fixed some unlikely core dumps - Better bug fixes for: - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null mysql-test/r/create.result: Update results after removing wrong warnings for CREATE ... SELECT New tests mysql-test/r/handler.result: Drop used tables mysql-test/r/kill.result: Make test portable mysql-test/r/mysqlshow.result: Drop tables used by previous test mysql-test/r/trigger.result: Reuse old procedure name mysql-test/r/view.result: Extra tests mysql-test/t/create.test: New tests to test fix of removing wrong warnings for CREATE ... SELECT mysql-test/t/disabled.def: Enable 'kill' test (should now be portable) mysql-test/t/handler.test: Drop used tables mysql-test/t/kill.test: Make test portable even if kill doesn't work at once mysql-test/t/mysqlshow.test: Drop tables used by previous test mysql-test/t/trigger.test: Reuse old procedure name mysql-test/t/view.test: Extra tests sql/field.cc: Removed compiler warning sql/ha_federated.cc: my_snprintf -> strmake() (Simple optimization) sql/ha_ndbcluster.cc: Indentation cleanups and trival optimization sql/item.cc: Moved save_org_in_field() to item.cc to make it easier to test Remove setting of null_value as this is not needed sql/item.h: Moved save_org_in_field() to item.cc to make it easier to test sql/log_event.cc: Remove inline of slave_load_file_stem() Added 'extension' parameter to slave_load_file_stem() to get smaller code Removed not critical (or needed) DBUG_ASSERT()'s Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths Indentation fixes sql/opt_range.cc: Moved code from declaration to function body (To make it more readable) sql/parse_file.cc: Fixed DBUG_PRINT sql/sp.cc: Simple cleanups - Removed not needed {} level - Ensure saved variables starts with old_ sql/sp_head.cc: Indentation fixes Remove core dump when using --debug when m_next_cached_sp == 0 Fixed compiler warnings Trivial optimizations sql/sp_head.h: Changed argument to set_definer() to const Added THD argument to recursion_level_error() to avoid call to current_thd sql/sql_acl.cc: Removed not needed test (first_not_own_table is the guard) sql/sql_base.cc: Removed extra empty line sql/sql_handler.cc: Don't test table version in mysql_ha_read() as this is already tested in lock_tables() Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables (Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash) sql/sql_insert.cc: Mark fields that are set in CREATE ... SELECT as used (Removed wrong warnings about field not having a default value) sql/sql_parse.cc: Removed not needed test of 'tables' (first_not_own_table is the guard) Simplify code sql/sql_select.cc: Use group->field to check if value is null instead of item called by 'save_org_in_field' This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null) sql/sql_trigger.cc: Move sql_modes_parameters outside of function Indentation fixes Fixed compiler warning Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access() (This allows us to remove the extra test in check_grant() and check_table_access())
2006-01-05 23:47:49 +01:00
delete g_ndb_cluster_connection;
g_ndb_cluster_connection= NULL;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
hash_free(&ndbcluster_open_tables);
pthread_mutex_destroy(&ndbcluster_mutex);
2005-02-11 22:33:52 +01:00
pthread_mutex_destroy(&LOCK_ndb_util_thread);
pthread_cond_destroy(&COND_ndb_util_thread);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ndbcluster_inited= 0;
ndbcluster_util_inited= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
/*
Static error print function called from
static handler method ndbcluster_commit
and ndbcluster_rollback
*/
void ndbcluster_print_error(int error, const NdbOperation *error_op)
{
DBUG_ENTER("ndbcluster_print_error");
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
TABLE_SHARE share;
const char *tab_name= (error_op) ? error_op->getTableName() : "";
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
share.db.str= (char*) "";
share.db.length= 0;
share.table_name.str= (char *) tab_name;
share.table_name.length= strlen(tab_name);
ha_ndbcluster error_handler(&share);
error_handler.print_error(error, MYF(0));
2004-07-06 08:43:57 +02:00
DBUG_VOID_RETURN;
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/**
* Set a given location from full pathname to database name
*
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
void ha_ndbcluster::set_dbname(const char *path_name, char *dbname)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
char *end, *ptr;
/* Scan name from the end */
ptr= strend(path_name)-1;
while (ptr >= path_name && *ptr != '\\' && *ptr != '/') {
ptr--;
}
ptr--;
end= ptr;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
while (ptr >= path_name && *ptr != '\\' && *ptr != '/') {
ptr--;
}
uint name_len= end - ptr;
memcpy(dbname, ptr + 1, name_len);
dbname[name_len]= '\0';
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#ifdef __WIN__
/* Put to lower case */
ptr= dbname;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
while (*ptr != '\0') {
*ptr= tolower(*ptr);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
ptr++;
}
#endif
}
/*
Set m_dbname from full pathname to table file
*/
void ha_ndbcluster::set_dbname(const char *path_name)
{
set_dbname(path_name, m_dbname);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/**
* Set a given location from full pathname to table file
*
*/
void
ha_ndbcluster::set_tabname(const char *path_name, char * tabname)
{
char *end, *ptr;
/* Scan name from the end */
end= strend(path_name)-1;
ptr= end;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
while (ptr >= path_name && *ptr != '\\' && *ptr != '/') {
ptr--;
}
uint name_len= end - ptr;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
memcpy(tabname, ptr + 1, end - ptr);
tabname[name_len]= '\0';
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
#ifdef __WIN__
/* Put to lower case */
ptr= tabname;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
while (*ptr != '\0') {
*ptr= tolower(*ptr);
ptr++;
}
#endif
}
/*
Set m_tabname from full pathname to table file
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
*/
void ha_ndbcluster::set_tabname(const char *path_name)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
set_tabname(path_name, m_tabname);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
ha_rows
key_cmp -> key_cmp_if_same New records_in_range() interface (similar to read_range()) Macros for faster bitmap handling Simplify read_range() code (#WL1786) New general key_cmp() function to compare keys heap/hp_hash.c: New records_in_range() interface include/heap.h: New records_in_range() interface include/my_base.h: Moved 'key_range' here so that all table handlers can use it include/my_bitmap.h: Make some bitmap functions inline for faster usage in one thread include/myisam.h: New records_in_range() interface include/myisammrg.h: New records_in_range() interface myisam/mi_range.c: New records_in_range() interface myisam/mi_test2.c: New records_in_range() interface myisam/rt_test.c: New records_in_range() interface Indentation fixes myisam/sp_test.c: New records_in_range() interface Indentation fixes myisammrg/myrg_range.c: New records_in_range() interface mysys/my_bitmap.c: Make some bitmap functions inline for faster usage in one thread sql/examples/ha_example.cc: New records_in_range() interface sql/field.cc: Fixed indentation sql/ha_berkeley.cc: New records_in_range() interface sql/ha_berkeley.h: New records_in_range() interface sql/ha_heap.cc: New records_in_range() interface sql/ha_heap.h: New records_in_range() interface sql/ha_innodb.cc: New records_in_range() interface sql/ha_innodb.h: New records_in_range() interface sql/ha_isam.cc: New records_in_range() interface sql/ha_isam.h: New records_in_range() interface sql/ha_myisam.cc: New records_in_range() interface sql/ha_myisam.h: New records_in_range() interface sql/ha_myisammrg.cc: New records_in_range() interface sql/ha_myisammrg.h: New records_in_range() interface sql/ha_ndbcluster.cc: New records_in_range() interface sql/ha_ndbcluster.h: New records_in_range() interface sql/handler.cc: Simplify read_range() interface: - Add 'eq_range' to read_range_first - Remove 'eq_range' parameer from read_range_next() - Trust values from index_next_same() - Simplfy compare_key() by moving key_comparision to key.cc (as this code can be reused from other places) sql/handler.h: Move key_range to my_base.h to be used by external table handlers Simplify read_range() interface New records_in_range() interface sql/key.cc: Rename key_cmp() to key_cmp_if_same() to make it more descriptive Add new key_cmp() function usable from range and handler code. sql/mysql_priv.h: Prototypes for new functions sql/opt_range.cc: New records_in_range() interface Simplify cmp_prev() (We can in 5.0 simplify cmp_next() the same way) sql/opt_range.h: Added key_part_info to QUICK_SELECT to be able to use key_cmp() in get_next() sql/opt_sum.cc: key_cmp -> key_cmp_if_same sql/sql_acl.cc: key_cmp -> key_cmp_if_same sql/sql_select.cc: key_cmp -> key_cmp_if_same
2004-05-16 13:48:32 +02:00
ha_ndbcluster::records_in_range(uint inx, key_range *min_key,
key_range *max_key)
{
KEY *key_info= table->key_info + inx;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
uint key_length= key_info->key_length;
NDB_INDEX_TYPE idx_type= get_index_type(inx);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_ENTER("records_in_range");
// Prevent partial read of hash indexes by returning HA_POS_ERROR
if ((idx_type == UNIQUE_INDEX || idx_type == PRIMARY_KEY_INDEX) &&
((min_key && min_key->length < key_length) ||
(max_key && max_key->length < key_length)))
DBUG_RETURN(HA_POS_ERROR);
// Read from hash index with full key
// This is a "const" table which returns only one record!
if ((idx_type != ORDERED_INDEX) &&
((min_key && min_key->length == key_length) ||
(max_key && max_key->length == key_length)))
DBUG_RETURN(1);
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
if ((idx_type == PRIMARY_KEY_ORDERED_INDEX ||
idx_type == UNIQUE_ORDERED_INDEX ||
idx_type == ORDERED_INDEX) &&
m_index[inx].index_stat != NULL)
{
NDB_INDEX_DATA& d=m_index[inx];
NDBINDEX* index=(NDBINDEX*)d.index;
Ndb* ndb=get_ndb();
NdbTransaction* trans=NULL;
NdbIndexScanOperation* op=NULL;
int res=0;
Uint64 rows;
do
{
// We must provide approx table rows
Uint64 table_rows=0;
Ndb_local_table_statistics *info=
(Ndb_local_table_statistics *)m_table_info;
if (info->records != ~(ha_rows)0 && info->records != 0)
{
table_rows = info->records;
DBUG_PRINT("info", ("use info->records: %llu", table_rows));
}
else
{
Ndb_statistics stat;
if ((res=ndb_get_table_statistics(ndb, m_tabname, &stat)) != 0)
break;
table_rows=stat.row_count;
DBUG_PRINT("info", ("use db row_count: %llu", table_rows));
if (table_rows == 0) {
// Problem if autocommit=0
#ifdef ndb_get_table_statistics_uses_active_trans
rows=0;
break;
#endif
}
}
// Define scan op for the range
if ((trans=m_active_trans) == NULL)
{
DBUG_PRINT("info", ("no active trans"));
if (! (trans=ndb->startTransaction()))
ERR_BREAK(ndb->getNdbError(), res);
}
if (! (op=trans->getNdbIndexScanOperation(index, (NDBTAB*)m_table)))
ERR_BREAK(trans->getNdbError(), res);
if ((op->readTuples(NdbOperation::LM_CommittedRead)) == -1)
ERR_BREAK(op->getNdbError(), res);
const key_range *keys[2]={ min_key, max_key };
if ((res=set_bounds(op, inx, true, keys)) != 0)
break;
// Decide if db should be contacted
int flags=0;
if (d.index_stat_query_count < d.index_stat_cache_entries ||
(d.index_stat_update_freq != 0 &&
d.index_stat_query_count % d.index_stat_update_freq == 0))
{
DBUG_PRINT("info", ("force stat from db"));
flags|=NdbIndexStat::RR_UseDb;
}
if (d.index_stat->records_in_range(index, op, table_rows, &rows, flags) == -1)
ERR_BREAK(d.index_stat->getNdbError(), res);
d.index_stat_query_count++;
} while (0);
if (trans != m_active_trans && rows == 0)
rows = 1;
if (trans != m_active_trans && trans != NULL)
ndb->closeTransaction(trans);
if (res != 0)
DBUG_RETURN(HA_POS_ERROR);
DBUG_RETURN(rows);
}
DBUG_RETURN(10); /* Good guess when you don't know anything */
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
ulong ha_ndbcluster::table_flags(void) const
{
if (m_ha_not_exact_count)
return m_table_flags | HA_NOT_EXACT_COUNT;
else
return m_table_flags;
}
const char * ha_ndbcluster::table_type() const
{
return("NDBCLUSTER");
}
uint ha_ndbcluster::max_supported_record_length() const
{
return NDB_MAX_TUPLE_SIZE;
}
uint ha_ndbcluster::max_supported_keys() const
{
return MAX_KEY;
}
uint ha_ndbcluster::max_supported_key_parts() const
{
return NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY;
}
uint ha_ndbcluster::max_supported_key_length() const
{
return NDB_MAX_KEY_SIZE;
}
bool ha_ndbcluster::low_byte_first() const
{
#ifdef WORDS_BIGENDIAN
return FALSE;
#else
return TRUE;
#endif
}
bool ha_ndbcluster::has_transactions()
{
return m_transaction_on;
}
const char* ha_ndbcluster::index_type(uint key_number)
{
switch (get_index_type(key_number)) {
case ORDERED_INDEX:
case UNIQUE_ORDERED_INDEX:
case PRIMARY_KEY_ORDERED_INDEX:
return "BTREE";
case UNIQUE_INDEX:
case PRIMARY_KEY_INDEX:
default:
return "HASH";
}
}
2005-02-11 22:33:52 +01:00
uint8 ha_ndbcluster::table_cache_type()
{
2005-02-11 22:33:52 +01:00
DBUG_ENTER("ha_ndbcluster::table_cache_type=HA_CACHE_TBL_ASKTRANSACT");
DBUG_RETURN(HA_CACHE_TBL_ASKTRANSACT);
}
uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
Uint64 *commit_count)
2005-02-11 22:33:52 +01:00
{
char name[FN_REFLEN];
NDB_SHARE *share;
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
DBUG_ENTER("ndb_get_commitcount");
(void)strxnmov(name, FN_REFLEN-1, share_prefix, dbname, "/", tabname, NullS);
DBUG_PRINT("enter", ("name: %s", name));
pthread_mutex_lock(&ndbcluster_mutex);
if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables,
(byte*) name,
strlen(name))))
{
pthread_mutex_unlock(&ndbcluster_mutex);
DBUG_PRINT("info", ("Table %s not found in ndbcluster_open_tables", name));
DBUG_RETURN(1);
}
share->use_count++;
pthread_mutex_unlock(&ndbcluster_mutex);
pthread_mutex_lock(&share->mutex);
2005-02-11 22:33:52 +01:00
if (ndb_cache_check_time > 0)
{
if (share->commit_count != 0)
2005-02-11 22:33:52 +01:00
{
*commit_count= share->commit_count;
DBUG_PRINT("info", ("Getting commit_count: %llu from share",
share->commit_count));
pthread_mutex_unlock(&share->mutex);
free_share(&share);
DBUG_RETURN(0);
2005-02-11 22:33:52 +01:00
}
}
DBUG_PRINT("info", ("Get commit_count from NDB"));
2005-02-11 22:33:52 +01:00
Ndb *ndb;
if (!(ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(1);
ndb->setDatabaseName(dbname);
uint lock= share->commit_count_lock;
pthread_mutex_unlock(&share->mutex);
2005-02-11 22:33:52 +01:00
struct Ndb_statistics stat;
if (ndb_get_table_statistics(ndb, tabname, &stat))
{
free_share(&share);
2005-02-11 22:33:52 +01:00
DBUG_RETURN(1);
}
pthread_mutex_lock(&share->mutex);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (share->commit_count_lock == lock)
{
DBUG_PRINT("info", ("Setting commit_count to %llu", stat.commit_count));
share->commit_count= stat.commit_count;
*commit_count= stat.commit_count;
}
else
{
DBUG_PRINT("info", ("Discarding commit_count, comit_count_lock changed"));
*commit_count= 0;
}
pthread_mutex_unlock(&share->mutex);
free_share(&share);
2005-02-11 22:33:52 +01:00
DBUG_RETURN(0);
}
/*
Check if a cached query can be used.
This is done by comparing the supplied engine_data to commit_count of
the table.
The commit_count is either retrieved from the share for the table, where
it has been cached by the util thread. If the util thread is not started,
NDB has to be contacetd to retrieve the commit_count, this will introduce
a small delay while waiting for NDB to answer.
SYNOPSIS
ndbcluster_cache_retrieval_allowed
thd thread handle
full_name concatenation of database name,
the null character '\0', and the table
name
full_name_len length of the full name,
i.e. len(dbname) + len(tablename) + 1
engine_data parameter retrieved when query was first inserted into
the cache. If the value of engine_data is changed,
all queries for this table should be invalidated.
RETURN VALUE
TRUE Yes, use the query from cache
FALSE No, don't use the cached query, and if engine_data
has changed, all queries for this table should be invalidated
*/
static my_bool
ndbcluster_cache_retrieval_allowed(THD *thd,
char *full_name, uint full_name_len,
ulonglong *engine_data)
2005-02-11 22:33:52 +01:00
{
DBUG_ENTER("ndbcluster_cache_retrieval_allowed");
Uint64 commit_count;
bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
char *dbname= full_name;
char *tabname= dbname+strlen(dbname)+1;
DBUG_PRINT("enter", ("dbname: %s, tabname: %s, is_autocommit: %d",
dbname, tabname, is_autocommit));
2005-02-11 22:33:52 +01:00
if (!is_autocommit)
{
DBUG_PRINT("exit", ("No, don't use cache in transaction"));
2005-02-11 22:33:52 +01:00
DBUG_RETURN(FALSE);
}
2005-02-11 22:33:52 +01:00
if (ndb_get_commitcount(thd, dbname, tabname, &commit_count))
{
*engine_data= 0; /* invalidate */
DBUG_PRINT("exit", ("No, could not retrieve commit_count"));
2005-02-11 22:33:52 +01:00
DBUG_RETURN(FALSE);
}
DBUG_PRINT("info", ("*engine_data: %llu, commit_count: %llu",
*engine_data, commit_count));
if (commit_count == 0)
2005-02-11 22:33:52 +01:00
{
*engine_data= 0; /* invalidate */
DBUG_PRINT("exit", ("No, local commit has been performed"));
2005-02-11 22:33:52 +01:00
DBUG_RETURN(FALSE);
}
else if (*engine_data != commit_count)
{
*engine_data= commit_count; /* invalidate */
DBUG_PRINT("exit", ("No, commit_count has changed"));
DBUG_RETURN(FALSE);
}
2005-02-11 22:33:52 +01:00
DBUG_PRINT("exit", ("OK to use cache, engine_data: %llu", *engine_data));
2005-02-11 22:33:52 +01:00
DBUG_RETURN(TRUE);
}
/**
Register a table for use in the query cache. Fetch the commit_count
for the table and return it in engine_data, this will later be used
to check if the table has changed, before the cached query is reused.
SYNOPSIS
ha_ndbcluster::can_query_cache_table
thd thread handle
full_name concatenation of database name,
the null character '\0', and the table
name
full_name_len length of the full name,
i.e. len(dbname) + len(tablename) + 1
qc_engine_callback function to be called before using cache on this table
engine_data out, commit_count for this table
RETURN VALUE
TRUE Yes, it's ok to cahce this query
FALSE No, don't cach the query
*/
my_bool
ha_ndbcluster::register_query_cache_table(THD *thd,
char *full_name, uint full_name_len,
qc_engine_callback *engine_callback,
ulonglong *engine_data)
2005-02-11 22:33:52 +01:00
{
DBUG_ENTER("ha_ndbcluster::register_query_cache_table");
bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
DBUG_PRINT("enter",("dbname: %s, tabname: %s, is_autocommit: %d",
m_dbname, m_tabname, is_autocommit));
2005-02-11 22:33:52 +01:00
if (!is_autocommit)
{
DBUG_PRINT("exit", ("Can't register table during transaction"))
2005-02-11 22:33:52 +01:00
DBUG_RETURN(FALSE);
}
2005-02-11 22:33:52 +01:00
Uint64 commit_count;
if (ndb_get_commitcount(thd, m_dbname, m_tabname, &commit_count))
{
*engine_data= 0;
DBUG_PRINT("exit", ("Error, could not get commitcount"))
2005-02-11 22:33:52 +01:00
DBUG_RETURN(FALSE);
}
*engine_data= commit_count;
*engine_callback= ndbcluster_cache_retrieval_allowed;
DBUG_PRINT("exit", ("commit_count: %llu", commit_count));
DBUG_RETURN(commit_count > 0);
}
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
2005-02-11 22:33:52 +01:00
#ifndef DBUG_OFF
static void dbug_print_table(const char *info, TABLE *table)
{
if (table == 0)
{
DBUG_PRINT("info",("%s: (null)", info));
return;
}
DBUG_PRINT("info",
("%s: %s.%s s->fields: %d "
"reclength: %d rec_buff_length: %d record[0]: %lx "
"record[1]: %lx",
info,
table->s->db,
table->s->table_name,
table->s->fields,
table->s->reclength,
table->s->rec_buff_length,
table->record[0],
table->record[1]));
for (unsigned int i= 0; i < table->s->fields; i++)
{
Field *f= table->field[i];
DBUG_PRINT("info",
("[%d] \"%s\"(0x%lx:%s%s%s%s%s%s) type: %d pack_length: %d "
"ptr: 0x%lx[+%d] null_bit: %u null_ptr: 0x%lx[+%d]",
i,
f->field_name,
f->flags,
(f->flags & PRI_KEY_FLAG) ? "pri" : "attr",
(f->flags & NOT_NULL_FLAG) ? "" : ",nullable",
(f->flags & UNSIGNED_FLAG) ? ",unsigned" : ",signed",
(f->flags & ZEROFILL_FLAG) ? ",zerofill" : "",
(f->flags & BLOB_FLAG) ? ",blob" : "",
(f->flags & BINARY_FLAG) ? ",binary" : "",
f->real_type(),
f->pack_length(),
f->ptr, f->ptr - table->record[0],
f->null_bit,
f->null_ptr, (byte*) f->null_ptr - table->record[0]));
if (f->type() == MYSQL_TYPE_BIT)
{
Field_bit *g= (Field_bit*) f;
DBUG_PRINT("MYSQL_TYPE_BIT",("field_length: %d bit_ptr: 0x%lx[+%d] "
"bit_ofs: %u bit_len: %u",
g->field_length, g->bit_ptr,
(byte*) g->bit_ptr-table->record[0],
g->bit_ofs, g->bit_len));
}
}
}
#endif
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
2005-02-11 22:33:52 +01:00
Handling the shared NDB_SHARE structure that is needed to
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
provide table locking.
It's also used for sharing data with other NDB handlers
in the same MySQL Server. There is currently not much
data we want to or can share.
*/
static byte *ndbcluster_get_key(NDB_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
*length= share->key_length;
return (byte*) share->key;
}
#ifndef DBUG_OFF
static void dbug_print_open_tables()
{
DBUG_ENTER("dbug_print_open_tables");
for (uint i= 0; i < ndbcluster_open_tables.records; i++)
{
NDB_SHARE *share= (NDB_SHARE*) hash_element(&ndbcluster_open_tables, i);
DBUG_PRINT("share",
("[%d] 0x%lx key: %s key_length: %d",
i, share, share->key, share->key_length));
DBUG_PRINT("share",
("db.tablename: %s.%s use_count: %d commit_count: %d",
share->db, share->table_name,
share->use_count, share->commit_count));
}
DBUG_VOID_RETURN;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
#else
#define dbug_print_open_tables()
#endif
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
/*
Increase refcount on existing share.
Always returns share and cannot fail.
*/
static NDB_SHARE *get_share(NDB_SHARE *share)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
pthread_mutex_lock(&ndbcluster_mutex);
share->use_count++;
dbug_print_open_tables();
DBUG_PRINT("get_share",
("0x%lx key: %s key_length: %d",
share, share->key, share->key_length));
DBUG_PRINT("get_share",
("db.tablename: %s.%s use_count: %d commit_count: %d",
share->db, share->table_name,
share->use_count, share->commit_count));
pthread_mutex_unlock(&ndbcluster_mutex);
return share;
}
/*
Get a share object for key
Returns share for key, and increases the refcount on the share.
create_if_not_exists == TRUE:
creates share if it does not alreade exist
returns 0 only due to out of memory, and then sets my_error
create_if_not_exists == FALSE:
returns 0 if share does not exist
have_lock == TRUE, pthread_mutex_lock(&ndbcluster_mutex) already taken
*/
static NDB_SHARE *get_share(const char *key, bool create_if_not_exists,
bool have_lock)
{
NDB_SHARE *share;
if (!have_lock)
pthread_mutex_lock(&ndbcluster_mutex);
uint length= (uint) strlen(key);
if (!(share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables,
(byte*) key,
length)))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
if (!create_if_not_exists)
{
DBUG_PRINT("error", ("get_share: %s does not exist", key));
if (!have_lock)
pthread_mutex_unlock(&ndbcluster_mutex);
return 0;
}
if ((share= (NDB_SHARE*) my_malloc(sizeof(*share),
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
MYF(MY_WME | MY_ZEROFILL))))
{
MEM_ROOT **root_ptr=
my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC);
MEM_ROOT *old_root= *root_ptr;
init_sql_alloc(&share->mem_root, 1024, 0);
*root_ptr= &share->mem_root; // remember to reset before return
/* enough space for key, db, and table_name */
share->key= alloc_root(*root_ptr, 2 * (length + 1));
share->key_length= length;
strmov(share->key, key);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (my_hash_insert(&ndbcluster_open_tables, (byte*) share))
{
free_root(&share->mem_root, MYF(0));
my_free((gptr) share, 0);
*root_ptr= old_root;
if (!have_lock)
pthread_mutex_unlock(&ndbcluster_mutex);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
return 0;
}
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
2005-02-11 22:33:52 +01:00
share->commit_count= 0;
share->commit_count_lock= 0;
share->db= share->key + length + 1;
ha_ndbcluster::set_dbname(key, share->db);
share->table_name= share->db + strlen(share->db) + 1;
ha_ndbcluster::set_tabname(key, share->table_name);
*root_ptr= old_root;
}
else
{
DBUG_PRINT("error", ("get_share: failed to alloc share"));
if (!have_lock)
pthread_mutex_unlock(&ndbcluster_mutex);
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(*share));
return 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
}
share->use_count++;
dbug_print_open_tables();
DBUG_PRINT("get_share",
("0x%lx key: %s key_length: %d key: %s",
share, share->key, share->key_length, key));
DBUG_PRINT("get_share",
("db.tablename: %s.%s use_count: %d commit_count: %d",
share->db, share->table_name,
share->use_count, share->commit_count));
if (!have_lock)
pthread_mutex_unlock(&ndbcluster_mutex);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
return share;
}
static void real_free_share(NDB_SHARE **share)
{
DBUG_PRINT("real_free_share",
("0x%lx key: %s key_length: %d",
(*share), (*share)->key, (*share)->key_length));
DBUG_PRINT("real_free_share",
("db.tablename: %s.%s use_count: %d commit_count: %d",
(*share)->db, (*share)->table_name,
(*share)->use_count, (*share)->commit_count));
hash_delete(&ndbcluster_open_tables, (byte*) *share);
thr_lock_delete(&(*share)->lock);
pthread_mutex_destroy(&(*share)->mutex);
free_root(&(*share)->mem_root, MYF(0));
my_free((gptr) *share, MYF(0));
*share= 0;
dbug_print_open_tables();
}
/*
decrease refcount of share
calls real_free_share when refcount reaches 0
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
have_lock == TRUE, pthread_mutex_lock(&ndbcluster_mutex) already taken
*/
static void free_share(NDB_SHARE **share, bool have_lock)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
if (!have_lock)
pthread_mutex_lock(&ndbcluster_mutex);
if ((*share)->util_lock == current_thd)
(*share)->util_lock= 0;
if (!--(*share)->use_count)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
real_free_share(share);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
else
{
dbug_print_open_tables();
DBUG_PRINT("free_share",
("0x%lx key: %s key_length: %d",
*share, (*share)->key, (*share)->key_length));
DBUG_PRINT("free_share",
("db.tablename: %s.%s use_count: %d commit_count: %d",
(*share)->db, (*share)->table_name,
(*share)->use_count, (*share)->commit_count));
}
if (!have_lock)
pthread_mutex_unlock(&ndbcluster_mutex);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
}
/*
Internal representation of the frm blob
*/
struct frm_blob_struct
{
struct frm_blob_header
{
uint ver; // Version of header
uint orglen; // Original length of compressed data
uint complen; // Compressed length of data, 0=uncompressed
} head;
char data[1];
};
static int packfrm(const void *data, uint len,
const void **pack_data, uint *pack_len)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
int error;
ulong org_len, comp_len;
uint blob_len;
frm_blob_struct* blob;
DBUG_ENTER("packfrm");
DBUG_PRINT("enter", ("data: 0x%lx len: %d", data, len));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
error= 1;
org_len= len;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
if (my_compress((byte*)data, &org_len, &comp_len))
goto err;
DBUG_PRINT("info", ("org_len: %d comp_len: %d", org_len, comp_len));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_DUMP("compressed", (char*)data, org_len);
error= 2;
blob_len= sizeof(frm_blob_struct::frm_blob_header)+org_len;
if (!(blob= (frm_blob_struct*) my_malloc(blob_len,MYF(MY_WME))))
goto err;
// Store compressed blob in machine independent format
int4store((char*)(&blob->head.ver), 1);
int4store((char*)(&blob->head.orglen), comp_len);
int4store((char*)(&blob->head.complen), org_len);
// Copy frm data into blob, already in machine independent format
memcpy(blob->data, data, org_len);
*pack_data= blob;
*pack_len= blob_len;
error= 0;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("exit",
("pack_data: 0x%lx pack_len: %d", *pack_data, *pack_len));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
err:
DBUG_RETURN(error);
}
static int unpackfrm(const void **unpack_data, uint *unpack_len,
const void *pack_data)
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
{
const frm_blob_struct *blob= (frm_blob_struct*)pack_data;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
byte *data;
ulong complen, orglen, ver;
DBUG_ENTER("unpackfrm");
DBUG_PRINT("enter", ("pack_data: 0x%lx", pack_data));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
complen= uint4korr((char*)&blob->head.complen);
orglen= uint4korr((char*)&blob->head.orglen);
ver= uint4korr((char*)&blob->head.ver);
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("blob",("ver: %d complen: %d orglen: %d",
ver,complen,orglen));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_DUMP("blob->data", (char*) blob->data, complen);
if (ver != 1)
DBUG_RETURN(1);
if (!(data= my_malloc(max(orglen, complen), MYF(MY_WME))))
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(2);
memcpy(data, blob->data, complen);
if (my_uncompress(data, &complen, &orglen))
{
my_free((char*)data, MYF(0));
DBUG_RETURN(3);
}
*unpack_data= data;
*unpack_len= complen;
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_PRINT("exit", ("frmdata: 0x%lx, len: %d", *unpack_data, *unpack_len));
Added NDB storage engine include/my_base.h: Added three new errorcodes to be returned by the handler sql/Makefile.am: Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h Add include path of NDB files sql/handler.cc: Added variable for keeping track of number of "discovers" Added NDB to list of storage engines Added calls to NDB for commit, rollback etc. Added function ha_discover for discovering a table from handler sql/handler.h: Added NDB to list of storage engines Added vbariable in transaction for keeping a ndb transaction handle sql/lex.h: Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash sql/mysql_priv.h: Added prototypes for new functions readfrm, writefrm and create_table_from_handler sql/mysqld.cc: Added NDB support Disable NDB with --skip-ndbcluster sql/set_var.cc: Add posibilty to show if NDB handler is supported sql/ha_ndbcluster.cc: Add ifdef for whole file for not compiling anything if NDB sholdn't be included Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now sql/sql_base.cc: If frm file is not found on disk, ask handler if it knows about the table. Then retry the open. This new functionality is called "discover" and can be used by any handler. sql/sql_class.h: Added variable for keeping a NDB connection handle sql/sql_table.cc: Before trying to create a table, ask handler if a table with that name already exists. If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler sql/sql_yacc.yy: Add NDBCLUSTER_SYM Change AND to AND_SYM Change OR to OR_SYM sql/table.cc: Fixe for probelm when NullS is returned from bas_ext of a handler.
2004-04-15 09:14:14 +02:00
DBUG_RETURN(0);
}
static
int
ndb_get_table_statistics(Ndb* ndb, const char * table,
struct Ndb_statistics * ndbstat)
{
DBUG_ENTER("ndb_get_table_statistics");
DBUG_PRINT("enter", ("table: %s", table));
NdbTransaction* pTrans= ndb->startTransaction();
if (pTrans == NULL)
ERR_RETURN(ndb->getNdbError());
do
{
NdbScanOperation* pOp= pTrans->getNdbScanOperation(table);
if (pOp == NULL)
break;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
if (pOp->readTuples(NdbOperation::LM_CommittedRead))
break;
int check= pOp->interpret_exit_last_row();
if (check == -1)
break;
Uint64 rows, commits, mem;
Uint32 size;
pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&rows);
pOp->getValue(NdbDictionary::Column::COMMIT_COUNT, (char*)&commits);
pOp->getValue(NdbDictionary::Column::ROW_SIZE, (char*)&size);
pOp->getValue(NdbDictionary::Column::FRAGMENT_MEMORY, (char*)&mem);
check= pTrans->execute(NdbTransaction::NoCommit,
NdbTransaction::AbortOnError,
TRUE);
if (check == -1)
break;
Uint32 count= 0;
Uint64 sum_rows= 0;
Uint64 sum_commits= 0;
Uint64 sum_row_size= 0;
Uint64 sum_mem= 0;
Cleanups during review Changed defaults option --instance to --defaults-group-suffix Changed option handling to allow --defaults-file, --defaults-extra-file and --defaults-group-suffix to be given in any order Changed MYSQL_INSTANCE to MYSQL_GROUP_SUFFIX mysql_print_defaults now understands --defaults-group-suffix Remove usage of my_tempnam() (not safe function) if( -> if ( and while( to while ( BitKeeper/deleted/.del-my_tempnam.c~a8562f15dad3012f: Delete: mysys/my_tempnam.c VC++Files/client/mysqlclient.dsp: Remove not used file my_tempnam.c VC++Files/client/mysqlclient_ia64.dsp: Remove not used file my_tempnam.c VC++Files/libmysql/libmysql.dsp: Remove not used file my_tempnam.c VC++Files/libmysql/libmysql_ia64.dsp: Remove not used file my_tempnam.c VC++Files/mysys/mysys.dsp: Remove not used file my_tempnam.c VC++Files/mysys/mysys_ia64.dsp: Remove not used file my_tempnam.c client/mysql.cc: Change to use get_defaults_options() Remove compiler warnings client/mysqldump.c: Indentation fixes Use quoted table name for 'primary_key_fields' extra/my_print_defaults.c: Add support for --defaults-group-suffix change to use get_default_options() extra/replace.c: Replace my_tempnam() with create_tmp_file() to allow us to remove my_tempnam.c include/config-win.h: Added DEFAULT_GROUP_SUFFIX_ENV include/my_sys.h: Change defaults_instance -> defaults_group_suffix Change get_defaults_files -> get_defaults_options libmysql/Makefile.shared: Added DEFAULT_GROUP_SUFFIX_ENV mysys/Makefile.am: Added DEFAULT_GROUP_SUFFIX_ENV Remove my_tempnam.c mysys/default.c: Changed --instance to --defaults-group-suffix Changed MYSQL_INSTANCE to MYSQL_GROUP_SUFFIX and moved the name to Makefile.am (mysys shouldn't by MySQL independent) Changed option handling to allow --defaults-file, --defaults-extra-file and --defaults-group-suffix to be given in any order mysys/default_modify.c: Optimized code to use allocated space more efficently Reduce code size Ensure that realloc() works independent of argument size mysys/my_bitmap.c: Added missing return sql/ha_innodb.cc: Change if( -> if ( sql/ha_ndbcluster.cc: Change while( -> while ( sql/item_cmpfunc.cc: Break loop early (simple optimization) sql/item_strfunc.cc: Change if( -> if ( sql/log.cc: Fixed comment sql/mysqld.cc: Change if( -> if ( sql/opt_range.cc: while( -> while ( if( -> if ( sql/parse_file.cc: Change if( -> if ( sql/sql_cache.cc: while( -> while ( sql/sql_parse.cc: Change if( -> if ( sql/sql_prepare.cc: Added comment sql/sql_select.cc: while( -> while ( Removed index variable by incrementing pointer sql/sql_show.cc: Change if( -> if ( sql/sql_yacc.yy: Change if( -> if ( tests/mysql_client_test.c: Added cast to first argument to bzero()
2005-07-18 14:33:18 +02:00
while ((check= pOp->nextResult(TRUE, TRUE)) == 0)
{
sum_rows+= rows;
sum_commits+= commits;
if (sum_row_size < size)
sum_row_size= size;
sum_mem+= mem;
count++;
}
if (check == -1)
break;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
pOp->close(TRUE);
ndb->closeTransaction(pTrans);
ndbstat->row_count= sum_rows;
ndbstat->commit_count= sum_commits;
ndbstat->row_size= sum_row_size;
ndbstat->fragment_memory= sum_mem;
DBUG_PRINT("exit", ("records: %llu commits: %llu "
"row_size: %llu mem: %llu count: %u",
sum_rows, sum_commits, sum_row_size,
sum_mem, count));
DBUG_RETURN(0);
Cleanups during review Changed defaults option --instance to --defaults-group-suffix Changed option handling to allow --defaults-file, --defaults-extra-file and --defaults-group-suffix to be given in any order Changed MYSQL_INSTANCE to MYSQL_GROUP_SUFFIX mysql_print_defaults now understands --defaults-group-suffix Remove usage of my_tempnam() (not safe function) if( -> if ( and while( to while ( BitKeeper/deleted/.del-my_tempnam.c~a8562f15dad3012f: Delete: mysys/my_tempnam.c VC++Files/client/mysqlclient.dsp: Remove not used file my_tempnam.c VC++Files/client/mysqlclient_ia64.dsp: Remove not used file my_tempnam.c VC++Files/libmysql/libmysql.dsp: Remove not used file my_tempnam.c VC++Files/libmysql/libmysql_ia64.dsp: Remove not used file my_tempnam.c VC++Files/mysys/mysys.dsp: Remove not used file my_tempnam.c VC++Files/mysys/mysys_ia64.dsp: Remove not used file my_tempnam.c client/mysql.cc: Change to use get_defaults_options() Remove compiler warnings client/mysqldump.c: Indentation fixes Use quoted table name for 'primary_key_fields' extra/my_print_defaults.c: Add support for --defaults-group-suffix change to use get_default_options() extra/replace.c: Replace my_tempnam() with create_tmp_file() to allow us to remove my_tempnam.c include/config-win.h: Added DEFAULT_GROUP_SUFFIX_ENV include/my_sys.h: Change defaults_instance -> defaults_group_suffix Change get_defaults_files -> get_defaults_options libmysql/Makefile.shared: Added DEFAULT_GROUP_SUFFIX_ENV mysys/Makefile.am: Added DEFAULT_GROUP_SUFFIX_ENV Remove my_tempnam.c mysys/default.c: Changed --instance to --defaults-group-suffix Changed MYSQL_INSTANCE to MYSQL_GROUP_SUFFIX and moved the name to Makefile.am (mysys shouldn't by MySQL independent) Changed option handling to allow --defaults-file, --defaults-extra-file and --defaults-group-suffix to be given in any order mysys/default_modify.c: Optimized code to use allocated space more efficently Reduce code size Ensure that realloc() works independent of argument size mysys/my_bitmap.c: Added missing return sql/ha_innodb.cc: Change if( -> if ( sql/ha_ndbcluster.cc: Change while( -> while ( sql/item_cmpfunc.cc: Break loop early (simple optimization) sql/item_strfunc.cc: Change if( -> if ( sql/log.cc: Fixed comment sql/mysqld.cc: Change if( -> if ( sql/opt_range.cc: while( -> while ( if( -> if ( sql/parse_file.cc: Change if( -> if ( sql/sql_cache.cc: while( -> while ( sql/sql_parse.cc: Change if( -> if ( sql/sql_prepare.cc: Added comment sql/sql_select.cc: while( -> while ( Removed index variable by incrementing pointer sql/sql_show.cc: Change if( -> if ( sql/sql_yacc.yy: Change if( -> if ( tests/mysql_client_test.c: Added cast to first argument to bzero()
2005-07-18 14:33:18 +02:00
} while (0);
BUG#9626 - Fix valgrind warnings - Remove static db, schema and table name buffers from Ndb.cpp mysys/thr_alarm.c: Initialise sact to zero ndb/include/kernel/ndb_limits.h: Set MAX_ATTR_NAME_SIZE to NAME_LEN which is tha maximum in MySQL ndb/include/kernel/signaldata/GetTabInfo.hpp: Clean up ndb/include/ndbapi/Ndb.hpp: Remove NDB_MAX_INTERNAL_NAME_LENGTH and all char buffers for schema, db and tablename. Made them dynamic and moved to NdbImpl.hpp ndb/include/ndbapi/ndbapi_limits.h: Remove the static length's of attr, db, schema and table name. ndb/src/common/transporter/Packer.cpp: Set theSignalId to ~0 when unpacking signal ndb/src/ndbapi/Ndb.cpp: Moved schema, database and tablename to NdbImpl.hpp ndb/src/ndbapi/NdbDictionaryImpl.cpp: Add NdbIndexImpl::init and NdbEventImpl::init Init all vars in NdbIndexImpl, NdbEventImpl, NdbTableImpl and NdbIndexImpl Delete the pseudo column NDB$RANGE_NO Copy tablename to internal buff in NdbDictInterface to get proper alignment. Convert length of table name from bytes words, when setting sz of LinearSectionPtr Set LinearSectionPtr array size to number of LinearSections used - save some stack. ndb/src/ndbapi/NdbDictionaryImpl.hpp: Add NdbEventImpl::init and NdbIndexImpl::init Remove clearNewProperties and copyNewProperties, it's easier to check if all vars are initied if it's done in the same func. Add buffer for tabname ti NdbDictInterface, memset it to 0 in initializer. ndb/src/ndbapi/NdbImpl.hpp: Use BaseString for table, schema and db names. ndb/src/ndbapi/Ndbinit.cpp: Move schema and db name to NdbImpl and use BaseString ndb/src/ndbapi/ndb_cluster_connection.cpp: Destroy ndb_global_event_buffer_mutex and ndb_print_state_mutex sql/ha_ndbcluster.cc: Check if pTrans is not null before calling closeTransaction Remove NDB_MAX_ATTR_NAME_SIZE Remove truncation of attr names. When attr name length is same in NDB as in MySQL this will be checked in functin check_column_name
2005-05-18 20:50:29 +02:00
if (pTrans)
ndb->closeTransaction(pTrans);
DBUG_PRINT("exit", ("failed"));
DBUG_RETURN(-1);
}
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
/*
Create a .ndb file to serve as a placeholder indicating
that the table with this name is a ndb table
*/
int ha_ndbcluster::write_ndb_file()
{
File file;
bool error=1;
char path[FN_REFLEN];
DBUG_ENTER("write_ndb_file");
DBUG_PRINT("enter", ("db: %s, name: %s", m_dbname, m_tabname));
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
(void)strxnmov(path, FN_REFLEN-1,
mysql_data_home,"/",m_dbname,"/",m_tabname,ha_ndb_ext,NullS);
WL1424 Multiple MySQL Servers: SHOW TABLES etc. should detect new and delete old tables. include/my_base.h: Added new bit to table create options Removed old error code HA_ERR_OLD_METADAT and reused it for HA_ERR_NO_SUCH_TABLE. mysql-test/r/ndb_autodiscover.result: Updated test cases mysql-test/t/ndb_autodiscover.test: Updated test cases mysql-test/t/ndb_autodiscover2.test: Updated test cases sql/discover.cc: Moved function create_table_from_handler to handler.cc sql/ha_ndbcluster.cc: Improved discover functionality Added .ndb file Changed error code mappings for a table that does not exist in engine Check for ndb object in THD Updated ndbcluster_discover, ndbcluster_list_tables and ndbcluster_can_discover sql/ha_ndbcluster.h: Improved discover sql/handler.cc: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/handler.h: Added new error message mapping. Moved function ha_create_table_from_engine to handler level Added new functions ha_can_discover, ha_list_tables and ha_table_exists sql/mysql_priv.h: Removed create_table_from_handler, moved to handler.h sql/sql_base.cc: Renamed function create_table_from_handler sql/sql_show.cc: Added new function mysql_discover_files and mysql_list_files. Modified mysql_find_files to discover new and delete "old" files/tables. sql/sql_table.cc: Renamed create_table_from_handler Call ha_create_table_from_engine, in order to discover the the frm file before it can be dropped. sql/table.cc: Added mapping of the error code HA_ERR_NO_SUCH_TABLE
2004-09-13 14:46:38 +02:00
if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0)
{
// It's an empty file
error=0;
my_close(file,MYF(0));
}
DBUG_RETURN(error);
}
int
ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
HANDLER_BUFFER *buffer)
{
DBUG_ENTER("ha_ndbcluster::read_multi_range_first");
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
m_write_op= FALSE;
int res;
KEY* key_info= table->key_info + active_index;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
NDB_INDEX_TYPE index_type= get_index_type(active_index);
2005-01-07 07:15:08 +01:00
ulong reclength= table->s->reclength;
NdbOperation* op;
WL 1682: Use bitvector instead of query_id to tell handler which fields to read and write Changed Server code, added new interface to handler and changed the NDB handler, InnoDB handler and Federated handler that previously used query_id Bug#10202 fix (one-liner fix for memory leak) mysys/my_bitmap.c: Debug code sql/field.cc: Initialise fieldnr to 0 if not set anywhere else sql/field.h: Introduce a fieldnr (first field = 1 and last = table->s->fields in field object to be able to quickly set appropriate bit in read/write set sql/ha_federated.cc: Changed federated handler to use write set instead of query_id sql/ha_innodb.cc: Changed InnoDB handler to use write set instead of query_id sql/ha_ndbcluster.cc: Changed NDB handler to use write set instead of query_id sql/ha_ndbcluster.h: Changed NDB handler to use write set instead of query_id sql/handler.cc: Allocate read_set and write_set either in get_new_handler or in special routine Routines used at destruction of handler object plus routine to set all primary key fields in read_set sql/handler.h: bool to keep track if read/write set allocated or not in handler Deallocate read/write set at delete of handler object New bitmap's for read/write set sql/item.cc: Set bits in read or write set (set_query_id = 2 => write_set set_query_id = 1 => read_set sql/lock.cc: Clear bit set when starting a new statement in external lock sql/mysql_priv.h: changed set_query_id from bool to ulong sql/opt_range.cc: Set primary key read set in all places where HA_EXTRA_RETRIEVE_PRIMARY_KEY is used sql/sql_acl.cc: set all bits in read set all places where HA_EXTRA_RETRIEVE_ALL_COLS are used sql/sql_base.cc: Clear all bits before start new statement when table locked already Set bit in read/write set dependent on set_query_id and fieldnr bool -> ulong for set_query_id set all bits in read set for SELECT * queries where table is not view sql/sql_class.h: Added comments + changed type of set_query_id sql/sql_insert.cc: Use 2 when setup_fields called for fields to updated in UPDATE and INSERT statements set primary key fields when EXTRA param used sql/sql_load.cc: Set all bits in write set if no fields specified in LOAD DATA FROM INFILE Otherwise use 2 to set specific fields to be updated by LOAD DATA... sql/sql_select.cc: Set primary key read set when EXTRA param specified Set fieldnr for temporary tables Set number of fields before calling get_new_handler and only set all bits if there at least one field in table sql/sql_table.cc: Set all bits in read set for old table and all bits in write set for new table for ALTER TABLE copy method Set all bits in read set when EXTRA param used sql/sql_udf.cc: Set all bits in read set when EXTRA param used sql/sql_update.cc: Set fields to UPDATE to use 2 for set_query_id Set all bits in read set when EXTRA param used sql/table.cc: Set fieldnr in openfrm Reallocate read/write set in openfrm since table->s->fields==0 at call to get_new_handler sql/unireg.cc: Fix Bug #10202
2005-04-28 14:45:27 +02:00
if (uses_blob_value())
{
/**
* blobs can't be batched currently
*/
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
m_disable_multi_read= TRUE;
DBUG_RETURN(handler::read_multi_range_first(found_range_p,
ranges,
range_count,
sorted,
buffer));
}
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
m_disable_multi_read= FALSE;
/**
* Copy arguments into member variables
*/
m_multi_ranges= ranges;
multi_range_curr= ranges;
multi_range_end= ranges+range_count;
multi_range_sorted= sorted;
multi_range_buffer= buffer;
/**
* read multi range will read ranges as follows (if not ordered)
*
* input read order
* ====== ==========
* pk-op 1 pk-op 1
* pk-op 2 pk-op 2
* range 3 range (3,5) NOTE result rows will be intermixed
* pk-op 4 pk-op 4
* range 5
* pk-op 6 pk-ok 6
*/
2005-01-11 14:06:44 +01:00
/**
* Variables for loop
*/
byte *curr= (byte*)buffer->buffer;
byte *end_of_buffer= (byte*)buffer->buffer_end;
NdbOperation::LockMode lm=
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
const NDBTAB *tab= (const NDBTAB *) m_table;
const NDBINDEX *unique_idx= (NDBINDEX *) m_index[active_index].unique_index;
const NDBINDEX *idx= (NDBINDEX *) m_index[active_index].index;
const NdbOperation* lastOp= m_active_trans->getLastDefinedOperation();
NdbIndexScanOperation* scanOp= 0;
for (; multi_range_curr<multi_range_end && curr+reclength <= end_of_buffer;
multi_range_curr++)
{
2005-07-18 13:31:02 +02:00
part_id_range part_spec;
if (m_use_partition_function)
{
get_partition_set(table, curr, active_index,
&multi_range_curr->start_key,
&part_spec);
if (part_spec.start_part > part_spec.end_part)
{
/*
We can skip this partition since the key won't fit into any
partition
*/
curr += reclength;
multi_range_curr->range_flag |= SKIP_RANGE;
continue;
}
}
switch(index_type){
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case PRIMARY_KEY_ORDERED_INDEX:
if (!(multi_range_curr->start_key.length == key_info->key_length &&
2005-07-18 13:31:02 +02:00
multi_range_curr->start_key.flag == HA_READ_KEY_EXACT))
goto range;
// else fall through
case PRIMARY_KEY_INDEX:
{
multi_range_curr->range_flag |= UNIQUE_RANGE;
if ((op= m_active_trans->getNdbOperation(tab)) &&
!op->readTuple(lm) &&
!set_primary_key(op, multi_range_curr->start_key.key) &&
!define_read_attrs(curr, op) &&
2005-07-18 13:31:02 +02:00
(op->setAbortOption(AO_IgnoreError), TRUE) &&
(!m_use_partition_function ||
(op->setPartitionId(part_spec.start_part), true)))
curr += reclength;
else
ERR_RETURN(op ? op->getNdbError() : m_active_trans->getNdbError());
break;
}
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case UNIQUE_ORDERED_INDEX:
if (!(multi_range_curr->start_key.length == key_info->key_length &&
2005-07-18 13:31:02 +02:00
multi_range_curr->start_key.flag == HA_READ_KEY_EXACT &&
!check_null_in_key(key_info, multi_range_curr->start_key.key,
multi_range_curr->start_key.length)))
goto range;
// else fall through
case UNIQUE_INDEX:
{
multi_range_curr->range_flag |= UNIQUE_RANGE;
if ((op= m_active_trans->getNdbIndexOperation(unique_idx, tab)) &&
!op->readTuple(lm) &&
!set_index_key(op, key_info, multi_range_curr->start_key.key) &&
!define_read_attrs(curr, op) &&
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
(op->setAbortOption(AO_IgnoreError), TRUE))
curr += reclength;
else
ERR_RETURN(op ? op->getNdbError() : m_active_trans->getNdbError());
break;
}
2005-07-18 13:31:02 +02:00
case ORDERED_INDEX: {
range:
multi_range_curr->range_flag &= ~(uint)UNIQUE_RANGE;
if (scanOp == 0)
{
if (m_multi_cursor)
{
scanOp= m_multi_cursor;
DBUG_ASSERT(scanOp->getSorted() == sorted);
DBUG_ASSERT(scanOp->getLockMode() ==
(NdbOperation::LockMode)get_ndb_lock_type(m_lock.type));
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (scanOp->reset_bounds(m_force_send))
DBUG_RETURN(ndb_err(m_active_trans));
end_of_buffer -= reclength;
}
else if ((scanOp= m_active_trans->getNdbIndexScanOperation(idx, tab))
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
&&!scanOp->readTuples(lm, 0, parallelism, sorted, FALSE, TRUE)
&&!generate_scan_filter(m_cond_stack, scanOp)
&&!define_read_attrs(end_of_buffer-reclength, scanOp))
{
m_multi_cursor= scanOp;
m_multi_range_cursor_result_ptr= end_of_buffer-reclength;
}
else
{
ERR_RETURN(scanOp ? scanOp->getNdbError() :
m_active_trans->getNdbError());
}
}
const key_range *keys[2]= { &multi_range_curr->start_key,
&multi_range_curr->end_key };
ndb - wl#2624 re-commit due to bk problem mysql-test/r/ndb_basic.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_blob.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_charset.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_condition_pushdown.result: wl#2624 re-commit due to bk problem mysql-test/r/ndb_index_ordered.result: wl#2624 re-commit due to bk problem mysql-test/t/ndb_index_ordered.test: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.cc: wl#2624 re-commit due to bk problem sql/ha_ndbcluster.h: wl#2624 re-commit due to bk problem sql/mysqld.cc: wl#2624 re-commit due to bk problem sql/set_var.cc: wl#2624 re-commit due to bk problem sql/sql_class.h: wl#2624 re-commit due to bk problem storage/ndb/include/kernel/AttributeHeader.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbDictionary.hpp: wl#2624 re-commit due to bk problem storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/kernel/blocks/dbtux/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/Makefile.am: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionary.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: wl#2624 re-commit due to bk problem storage/ndb/src/ndbapi/NdbScanOperation.cpp: wl#2624 re-commit due to bk problem
2005-09-15 02:33:28 +02:00
if ((res= set_bounds(scanOp, active_index, false, keys,
multi_range_curr-ranges)))
DBUG_RETURN(res);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case UNDEFINED_INDEX:
2005-01-11 14:06:44 +01:00
DBUG_ASSERT(FALSE);
DBUG_RETURN(1);
break;
}
}
if (multi_range_curr != multi_range_end)
{
/**
* Mark that we're using entire buffer (even if might not) as
* we haven't read all ranges for some reason
* This as we don't want mysqld to reuse the buffer when we read
* the remaining ranges
*/
buffer->end_of_used_area= (byte*)buffer->buffer_end;
}
else
{
buffer->end_of_used_area= curr;
}
/**
* Set first operation in multi range
*/
m_current_multi_operation=
lastOp ? lastOp->next() : m_active_trans->getFirstDefinedOperation();
if (!(res= execute_no_commit_ie(this, m_active_trans)))
{
m_multi_range_defined= multi_range_curr;
multi_range_curr= ranges;
m_multi_range_result_ptr= (byte*)buffer->buffer;
DBUG_RETURN(read_multi_range_next(found_range_p));
}
ERR_RETURN(m_active_trans->getNdbError());
}
#if 0
2005-07-18 13:31:02 +02:00
#define DBUG_MULTI_RANGE(x) DBUG_PRINT("info", ("read_multi_range_next: case %d\n", x));
#else
#define DBUG_MULTI_RANGE(x)
#endif
int
ha_ndbcluster::read_multi_range_next(KEY_MULTI_RANGE ** multi_range_found_p)
{
DBUG_ENTER("ha_ndbcluster::read_multi_range_next");
if (m_disable_multi_read)
{
2005-07-18 13:31:02 +02:00
DBUG_MULTI_RANGE(11);
DBUG_RETURN(handler::read_multi_range_next(multi_range_found_p));
}
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
int res;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
int range_no;
2005-01-07 07:15:08 +01:00
ulong reclength= table->s->reclength;
const NdbOperation* op= m_current_multi_operation;
for (;multi_range_curr < m_multi_range_defined; multi_range_curr++)
{
2005-07-18 13:31:02 +02:00
DBUG_MULTI_RANGE(12);
if (multi_range_curr->range_flag & SKIP_RANGE)
continue;
if (multi_range_curr->range_flag & UNIQUE_RANGE)
{
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
if (op->getNdbError().code == 0)
2005-07-18 13:31:02 +02:00
{
DBUG_MULTI_RANGE(13);
goto found_next;
2005-07-18 13:31:02 +02:00
}
op= m_active_trans->getNextCompletedOperation(op);
m_multi_range_result_ptr += reclength;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
continue;
}
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
else if (m_multi_cursor && !multi_range_sorted)
{
DBUG_MULTI_RANGE(1);
if ((res= fetch_next(m_multi_cursor)) == 0)
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
DBUG_MULTI_RANGE(2);
range_no= m_multi_cursor->get_range_no();
goto found;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
}
else
{
2005-07-18 13:31:02 +02:00
DBUG_MULTI_RANGE(14);
goto close_scan;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
}
}
else if (m_multi_cursor && multi_range_sorted)
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
if (m_active_cursor && (res= fetch_next(m_multi_cursor)))
{
DBUG_MULTI_RANGE(3);
goto close_scan;
}
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
range_no= m_multi_cursor->get_range_no();
uint current_range_no= multi_range_curr - m_multi_ranges;
2005-01-11 14:06:44 +01:00
if ((uint) range_no == current_range_no)
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
DBUG_MULTI_RANGE(4);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
// return current row
goto found;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
}
else if (range_no > (int)current_range_no)
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
{
DBUG_MULTI_RANGE(5);
// wait with current row
m_active_cursor= 0;
continue;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
}
else
{
DBUG_MULTI_RANGE(6);
// First fetch from cursor
DBUG_ASSERT(range_no == -1);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if ((res= m_multi_cursor->nextResult(true)))
{
2005-07-18 13:31:02 +02:00
DBUG_MULTI_RANGE(15);
goto close_scan;
}
multi_range_curr--; // Will be increased in for-loop
continue;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
}
}
else /** m_multi_cursor == 0 */
{
DBUG_MULTI_RANGE(7);
/**
* Corresponds to range 5 in example in read_multi_range_first
*/
(void)1;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
continue;
}
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
DBUG_ASSERT(FALSE); // Should only get here via goto's
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
close_scan:
if (res == 1)
{
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
m_multi_cursor->close(FALSE, TRUE);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
m_active_cursor= m_multi_cursor= 0;
DBUG_MULTI_RANGE(8);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
continue;
}
else
{
2005-07-18 13:31:02 +02:00
DBUG_MULTI_RANGE(9);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
DBUG_RETURN(ndb_err(m_active_trans));
}
}
if (multi_range_curr == multi_range_end)
2005-07-18 13:31:02 +02:00
{
DBUG_MULTI_RANGE(16);
DBUG_RETURN(HA_ERR_END_OF_FILE);
2005-07-18 13:31:02 +02:00
}
/**
* Read remaining ranges
*/
DBUG_RETURN(read_multi_range_first(multi_range_found_p,
multi_range_curr,
multi_range_end - multi_range_curr,
multi_range_sorted,
multi_range_buffer));
found:
/**
* Found a record belonging to a scan
*/
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
m_active_cursor= m_multi_cursor;
* multi_range_found_p= m_multi_ranges + range_no;
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
memcpy(table->record[0], m_multi_range_cursor_result_ptr, reclength);
setup_recattr(m_active_cursor->getFirstRecAttr());
unpack_record(table->record[0]);
table->status= 0;
DBUG_RETURN(0);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
found_next:
/**
* Found a record belonging to a pk/index op,
* copy result and move to next to prepare for next call
*/
* multi_range_found_p= multi_range_curr;
memcpy(table->record[0], m_multi_range_result_ptr, reclength);
setup_recattr(op->getFirstRecAttr());
unpack_record(table->record[0]);
table->status= 0;
multi_range_curr++;
m_current_multi_operation= m_active_trans->getNextCompletedOperation(op);
m_multi_range_result_ptr += reclength;
DBUG_RETURN(0);
}
int
ha_ndbcluster::setup_recattr(const NdbRecAttr* curr)
{
DBUG_ENTER("setup_recattr");
Field **field, **end;
NdbValue *value= m_value;
2005-01-07 07:15:08 +01:00
end= table->field + table->s->fields;
for (field= table->field; field < end; field++, value++)
{
if ((* value).ptr)
{
DBUG_ASSERT(curr != 0);
wl2126 - ndb - fix last unhandled part of read_multi_range reading sorted multi_range with several range-scans BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6: Delete: ndb/include/ndbapi/NdbResultSet.hpp BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: Delete: ndb/src/ndbapi/NdbResultSet.cpp ndb/include/ndbapi/NdbApi.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbIndexScanOperation.hpp: Remove NdbResultSet ndb/include/ndbapi/NdbScanOperation.hpp: Remove NdbResultSet ndb/src/ndbapi/Makefile.am: Remove NdbResultSet ndb/src/ndbapi/NdbConnection.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbIndexOperation.cpp: Remove NdbResultSet ndb/src/ndbapi/NdbScanOperation.cpp: Remove NdbResultSet ndb/test/include/HugoOperations.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanFunctions.hpp: Remove NdbResultSet ndb/test/ndbapi/ScanInterpretTest.hpp: Remove NdbResultSet ndb/test/ndbapi/bank/Bank.cpp: Remove NdbResultSet ndb/test/ndbapi/bank/BankLoad.cpp: Remove NdbResultSet ndb/test/ndbapi/slow_select.cpp: Remove NdbResultSet ndb/test/ndbapi/testBlobs.cpp: Remove NdbResultSet ndb/test/ndbapi/testDataBuffers.cpp: Remove NdbResultSet ndb/test/ndbapi/testDeadlock.cpp: Remove NdbResultSet ndb/test/ndbapi/testIndex.cpp: Remove NdbResultSet ndb/test/ndbapi/testOIBasic.cpp: Remove NdbResultSet ndb/test/ndbapi/testReadPerf.cpp: Remove NdbResultSet ndb/test/ndbapi/testScan.cpp: Remove NdbResultSet ndb/test/ndbapi/testScanPerf.cpp: Remove NdbResultSet ndb/test/src/HugoOperations.cpp: Remove NdbResultSet ndb/test/src/HugoTransactions.cpp: Remove NdbResultSet ndb/test/src/UtilTransactions.cpp: Remove NdbResultSet ndb/tools/delete_all.cpp: Remove NdbResultSet ndb/tools/select_all.cpp: Remove NdbResultSet ndb/tools/select_count.cpp: Remove NdbResultSet sql/ha_ndbcluster.cc: 1) Fix a = 3 -> a= 3 2) Impl. last part of wl2126 ordered "multi ordered scan"
2004-12-07 15:15:49 +01:00
(* value).rec= curr;
curr= curr->next();
}
}
DBUG_RETURN(0);
}
2005-02-11 22:33:52 +01:00
char*
ha_ndbcluster::update_table_comment(
/* out: table comment + additional */
const char* comment)/* in: table comment defined by user */
2005-02-11 22:33:52 +01:00
{
uint length= strlen(comment);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (length > 64000 - 3)
2005-02-11 22:33:52 +01:00
{
return((char*)comment); /* string too long */
}
Ndb* ndb;
if (!(ndb= get_ndb()))
{
return((char*)comment);
}
ndb->setDatabaseName(m_dbname);
NDBDICT* dict= ndb->getDictionary();
const NDBTAB* tab;
if (!(tab= dict->getTable(m_tabname)))
{
return((char*)comment);
}
char *str;
const char *fmt="%s%snumber_of_replicas: %d";
const unsigned fmt_len_plus_extra= length + strlen(fmt);
if ((str= my_malloc(fmt_len_plus_extra, MYF(0))) == NULL)
{
return (char*)comment;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
my_snprintf(str,fmt_len_plus_extra,fmt,comment,
length > 0 ? " ":"",
tab->getReplicaCount());
2005-02-11 22:33:52 +01:00
return str;
}
// Utility thread main loop
pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
2005-02-11 22:33:52 +01:00
{
THD *thd; /* needs to be first for thread_stack */
Ndb* ndb;
2005-02-11 22:33:52 +01:00
struct timespec abstime;
List<NDB_SHARE> util_open_tables;
2005-02-11 22:33:52 +01:00
my_thread_init();
DBUG_ENTER("ndb_util_thread");
DBUG_PRINT("enter", ("ndb_cache_check_time: %d", ndb_cache_check_time));
thd= new THD; /* note that contructor of THD uses DBUG_ */
THD_CHECK_SENTRY(thd);
ndb= new Ndb(g_ndb_cluster_connection, "");
2005-02-11 22:33:52 +01:00
pthread_detach_this_thread();
ndb_util_thread= pthread_self();
thd->thread_stack= (char*)&thd; /* remember where our stack is */
if (thd->store_globals() && (ndb->init() != -1))
2005-02-11 22:33:52 +01:00
{
thd->cleanup();
delete thd;
delete ndb;
2005-02-11 22:33:52 +01:00
DBUG_RETURN(NULL);
}
thd->init_for_queries();
thd->version=refresh_version;
thd->set_time();
thd->main_security_ctx.host_or_ip= "";
thd->client_capabilities = 0;
my_net_init(&thd->net, 0);
thd->main_security_ctx.master_access= ~0;
thd->main_security_ctx.priv_user = 0;
/*
wait for mysql server to start
*/
pthread_mutex_lock(&LOCK_server_started);
while (!mysqld_server_started)
pthread_cond_wait(&COND_server_started, &LOCK_server_started);
pthread_mutex_unlock(&LOCK_server_started);
/*
Wait for cluster to start
*/
pthread_mutex_lock(&LOCK_ndb_util_thread);
while (!ndb_cluster_node_id)
{
/* ndb not connected yet */
set_timespec(abstime, 1);
pthread_cond_timedwait(&COND_ndb_util_thread,
&LOCK_ndb_util_thread,
&abstime);
if (abort_loop)
{
pthread_mutex_unlock(&LOCK_ndb_util_thread);
goto ndb_util_thread_end;
}
}
pthread_mutex_unlock(&LOCK_ndb_util_thread);
/*
Get all table definitions from the storage node
*/
ndbcluster_find_all_files(thd);
ndbcluster_util_inited= 1;
2005-02-11 22:33:52 +01:00
set_timespec(abstime, 0);
for (;!abort_loop;)
2005-02-11 22:33:52 +01:00
{
pthread_mutex_lock(&LOCK_ndb_util_thread);
Reviewing new pushed code - CHAR() now returns binary string as default - CHAR(X*65536+Y*256+Z) is now equal to CHAR(X,Y,Z) independent of the character set for CHAR() - Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() (Some old systems returns ETIME and it's safer to test for both values than to try to write a wrapper for each old system) - Fixed new introduced bug in NOT BETWEEN X and X - Ensure we call commit_by_xid or rollback_by_xid for all engines, even if one engine has failed - Use octet2hex() for all conversion of string to hex - Simplify and optimize code client/mysqldump.c: Simple optimizations of new code Indentation fixes client/mysqltest.c: Removed not needed variable include/mysql_com.h: Made octec2hex() more usable mysql-test/r/ctype_utf8.result: CHAR() now returns binary string as default mysql-test/r/func_str.result: CHAR() now returns binary string as default mysql-test/r/range.result: Added test to verify new introduced bug in NOT BETWEEN X and X mysql-test/r/user_var-binlog.result: CHAR() now returns binary string as default mysql-test/r/view.result: More tests of view rename mysql-test/t/ctype_utf8.test: CHAR() now returns binary string as default mysql-test/t/func_str.test: CHAR() now returns binary string as default mysql-test/t/range.test: Added test to verify new introduced bug in NOT BETWEEN X and X mysql-test/t/view.test: More tests of view rename mysys/mf_keycache.c: Indentation changes Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() mysys/my_os2cond.c: Fix to MySQL coding style Optimized functions mysys/thr_lock.c: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() mysys/thr_mutex.c: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() server-tools/instance-manager/instance.cc: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() server-tools/instance-manager/thread_registry.cc: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() sql/ha_federated.cc: Use octet2hex() sql/ha_ndbcluster.cc: Removed not used variable sql/handler.cc: Simplify code Use *NONE* instead of 'none' for not existing storage engine Ensure we call commit_by_xid or rollback_by_xid for all engines, even if one engine has failed sql/item.h: Remove not needed test for *ref. (If ref is set, it should never point at 0) sql/item_func.cc: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() Simplify code More comments Require that last argument to find_and_check_access() is given (Made code shorter and faster) sql/item_strfunc.cc: Changed CHAR() to return result in binary collation CHAR(X*65536+Y*256+Z) is now equal to CHAR(X,Y,Z) independent of the character set for CHAR() Bar will shortly add the following syntax: CHAR(.... USING character_set) and ensure that CONVERT(CHAR(....) USING utf8) cuts not legal utf8 strings Use ocet2hex() sql/item_strfunc.h: CHAR() now returns a binary string sql/log_event.cc: Use octet2hex() Simplify code sql/parse_file.cc: Indentation fixes Use for() instead of while() sql/password.c: Make octet2hex() more generally usable by returning pointer to end 0 sql/slave.cc: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() sql/sql_base.cc: Indentation fixes sql/sql_insert.cc: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() sql/sql_manager.cc: Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait() sql/sql_parse.cc: Don't check thd->db when checking for function privileges sql/sql_prepare.cc: Fixed wrong merge sql/sql_select.cc: Fixed new bug for NOT BETWEEN X and X sql/sql_show.cc: Removed not used variable sql/sql_table.cc: Indentation fixed Removed DBUG_PRINT that is obvious from context sql/sql_view.cc: Simplify code sql/unireg.cc: Use octet2hex()
2005-10-11 23:58:22 +02:00
pthread_cond_timedwait(&COND_ndb_util_thread,
&LOCK_ndb_util_thread,
&abstime);
2005-02-11 22:33:52 +01:00
pthread_mutex_unlock(&LOCK_ndb_util_thread);
#ifdef NDB_EXTRA_DEBUG_UTIL_THREAD
2005-02-11 22:33:52 +01:00
DBUG_PRINT("ndb_util_thread", ("Started, ndb_cache_check_time: %d",
ndb_cache_check_time));
#endif
2005-02-11 22:33:52 +01:00
if (abort_loop)
break; /* Shutting down server */
if (ndb_cache_check_time == 0)
{
/* Wake up in 1 second to check if value has changed */
set_timespec(abstime, 1);
2005-02-11 22:33:52 +01:00
continue;
}
/* Lock mutex and fill list with pointers to all open tables */
NDB_SHARE *share;
pthread_mutex_lock(&ndbcluster_mutex);
for (uint i= 0; i < ndbcluster_open_tables.records; i++)
{
share= (NDB_SHARE *)hash_element(&ndbcluster_open_tables, i);
share->use_count++; /* Make sure the table can't be closed */
DBUG_PRINT("ndb_util_thread",
("Found open table[%d]: %s, use_count: %d",
i, share->table_name, share->use_count));
/* Store pointer to table */
util_open_tables.push_back(share);
}
pthread_mutex_unlock(&ndbcluster_mutex);
/* Iterate through the open files list */
List_iterator_fast<NDB_SHARE> it(util_open_tables);
while ((share= it++))
2005-02-11 22:33:52 +01:00
{
DBUG_PRINT("ndb_util_thread",
("Fetching commit count for: %s",
share->key));
2005-02-11 22:33:52 +01:00
/* Contact NDB to get commit count for table */
ndb->setDatabaseName(share->db);
struct Ndb_statistics stat;
uint lock;
pthread_mutex_lock(&share->mutex);
lock= share->commit_count_lock;
pthread_mutex_unlock(&share->mutex);
if (ndb_get_table_statistics(ndb, share->table_name, &stat) == 0)
2005-02-11 22:33:52 +01:00
{
DBUG_PRINT("ndb_util_thread",
("Table: %s, commit_count: %llu, rows: %llu",
share->key, stat.commit_count, stat.row_count));
2005-02-11 22:33:52 +01:00
}
else
{
DBUG_PRINT("ndb_util_thread",
("Error: Could not get commit count for table %s",
share->key));
stat.commit_count= 0;
2005-02-11 22:33:52 +01:00
}
pthread_mutex_lock(&share->mutex);
if (share->commit_count_lock == lock)
share->commit_count= stat.commit_count;
pthread_mutex_unlock(&share->mutex);
2005-02-11 22:33:52 +01:00
/* Decrease the use count and possibly free share */
free_share(&share);
2005-02-11 22:33:52 +01:00
}
/* Clear the list of open tables */
util_open_tables.empty();
/* Calculate new time to wake up */
int secs= 0;
int msecs= ndb_cache_check_time;
struct timeval tick_time;
gettimeofday(&tick_time, 0);
abstime.tv_sec= tick_time.tv_sec;
abstime.tv_nsec= tick_time.tv_usec * 1000;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (msecs >= 1000){
secs= msecs / 1000;
msecs= msecs % 1000;
}
abstime.tv_sec+= secs;
abstime.tv_nsec+= msecs * 1000000;
if (abstime.tv_nsec >= 1000000000) {
abstime.tv_sec+= 1;
abstime.tv_nsec-= 1000000000;
}
2005-02-11 22:33:52 +01:00
}
ndb_util_thread_end:
net_end(&thd->net);
2005-02-11 22:33:52 +01:00
thd->cleanup();
delete thd;
delete ndb;
2005-02-11 22:33:52 +01:00
DBUG_PRINT("exit", ("ndb_util_thread"));
my_thread_end();
pthread_exit(0);
DBUG_RETURN(NULL);
}
2004-12-17 21:13:22 +01:00
/*
Condition pushdown
*/
/*
Push a condition to ndbcluster storage engine for evaluation
during table and index scans. The conditions will be stored on a stack
for possibly storing several conditions. The stack can be popped
by calling cond_pop, handler::extra(HA_EXTRA_RESET) (handler::reset())
will clear the stack.
The current implementation supports arbitrary AND/OR nested conditions
with comparisons between columns and constants (including constant
expressions and function calls) and the following comparison operators:
=, !=, >, >=, <, <=, "is null", and "is not null".
RETURN
NULL The condition was supported and will be evaluated for each
row found during the scan
cond The condition was not supported and all rows will be returned from
the scan for evaluation (and thus not saved on stack)
*/
2004-12-17 21:13:22 +01:00
const
COND*
ha_ndbcluster::cond_push(const COND *cond)
{
DBUG_ENTER("cond_push");
Ndb_cond_stack *ndb_cond = new Ndb_cond_stack();
DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname););
if (m_cond_stack)
2005-05-07 22:41:30 +02:00
ndb_cond->next= m_cond_stack;
else
ndb_cond->next= NULL;
m_cond_stack= ndb_cond;
if (serialize_cond(cond, ndb_cond))
{
2005-02-11 22:05:24 +01:00
DBUG_RETURN(NULL);
}
else
{
cond_pop();
2005-02-11 22:05:24 +01:00
}
2004-12-17 21:13:22 +01:00
DBUG_RETURN(cond);
}
/*
Pop the top condition from the condition stack of the handler instance.
*/
2004-12-17 21:13:22 +01:00
void
ha_ndbcluster::cond_pop()
{
Ndb_cond_stack *ndb_cond_stack= m_cond_stack;
if (ndb_cond_stack)
{
m_cond_stack= ndb_cond_stack->next;
delete ndb_cond_stack;
}
2005-02-11 22:05:24 +01:00
}
2004-12-17 21:13:22 +01:00
/*
Clear the condition stack
*/
2004-12-17 21:13:22 +01:00
void
ha_ndbcluster::cond_clear()
{
DBUG_ENTER("cond_clear");
while (m_cond_stack)
cond_pop();
DBUG_VOID_RETURN;
}
/*
Serialize the item tree into a linked list represented by Ndb_cond
for fast generation of NbdScanFilter. Adds information such as
position of fields that is not directly available in the Item tree.
Also checks if condition is supported.
*/
2004-12-17 21:13:22 +01:00
void ndb_serialize_cond(const Item *item, void *arg)
{
Ndb_cond_traverse_context *context= (Ndb_cond_traverse_context *) arg;
DBUG_ENTER("ndb_serialize_cond");
2005-02-11 22:05:24 +01:00
// Check if we are skipping arguments to a function to be evaluated
if (context->skip)
{
DBUG_PRINT("info", ("Skiping argument %d", context->skip));
context->skip--;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (item->type()) {
case Item::FUNC_ITEM:
{
2005-02-11 22:05:24 +01:00
Item_func *func_item= (Item_func *) item;
context->skip+= func_item->argument_count();
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::INT_ITEM:
case Item::REAL_ITEM:
case Item::STRING_ITEM:
case Item::VARBIN_ITEM:
case Item::DECIMAL_ITEM:
2005-02-11 22:05:24 +01:00
break;
default:
context->supported= FALSE;
2005-02-11 22:05:24 +01:00
break;
}
2005-02-11 22:05:24 +01:00
DBUG_VOID_RETURN;
}
if (context->supported)
2004-12-17 21:13:22 +01:00
{
Ndb_rewrite_context *rewrite_context= context->rewrite_stack;
const Item_func *func_item;
// Check if we are rewriting some unsupported function call
if (rewrite_context &&
(func_item= rewrite_context->func_item) &&
rewrite_context->count++ == 0)
2005-02-11 22:05:24 +01:00
{
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (func_item->functype()) {
case Item_func::BETWEEN:
/*
Rewrite
<field>|<const> BETWEEN <const1>|<field1> AND <const2>|<field2>
to <field>|<const> > <const1>|<field1> AND
<field>|<const> < <const2>|<field2>
or actually in prefix format
BEGIN(AND) GT(<field>|<const>, <const1>|<field1>),
LT(<field>|<const>, <const2>|<field2>), END()
*/
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::IN_FUNC:
{
/*
Rewrite <field>|<const> IN(<const1>|<field1>, <const2>|<field2>,..)
to <field>|<const> = <const1>|<field1> OR
<field> = <const2>|<field2> ...
or actually in prefix format
BEGIN(OR) EQ(<field>|<const>, <const1><field1>),
EQ(<field>|<const>, <const2>|<field2>), ... END()
Each part of the disjunction is added for each call
to ndb_serialize_cond and end of rewrite statement
is wrapped in end of ndb_serialize_cond
*/
if (context->expecting(item->type()))
{
// This is the <field>|<const> item, save it in the rewrite context
rewrite_context->left_hand_item= item;
if (item->type() == Item::FUNC_ITEM)
{
Item_func *func_item= (Item_func *) item;
if (func_item->functype() == Item_func::UNKNOWN_FUNC &&
func_item->const_item())
{
// Skip any arguments since we will evaluate function instead
DBUG_PRINT("info", ("Skip until end of arguments marker"));
context->skip= func_item->argument_count();
}
else
{
DBUG_PRINT("info", ("Found unsupported functional expression in BETWEEN|IN"));
context->supported= FALSE;
DBUG_VOID_RETURN;
}
}
}
else
{
// Non-supported BETWEEN|IN expression
DBUG_PRINT("info", ("Found unexpected item of type %u in BETWEEN|IN",
item->type()));
context->supported= FALSE;
DBUG_VOID_RETURN;
}
break;
}
default:
context->supported= FALSE;
break;
}
DBUG_VOID_RETURN;
}
else
{
Ndb_cond_stack *ndb_stack= context->stack_ptr;
Ndb_cond *prev_cond= context->cond_ptr;
Ndb_cond *curr_cond= context->cond_ptr= new Ndb_cond();
if (!ndb_stack->ndb_cond)
ndb_stack->ndb_cond= curr_cond;
curr_cond->prev= prev_cond;
if (prev_cond) prev_cond->next= curr_cond;
// Check if we are rewriting some unsupported function call
if (context->rewrite_stack)
{
Ndb_rewrite_context *rewrite_context= context->rewrite_stack;
const Item_func *func_item= rewrite_context->func_item;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (func_item->functype()) {
case Item_func::BETWEEN:
{
/*
Rewrite
<field>|<const> BETWEEN <const1>|<field1> AND <const2>|<field2>
to <field>|<const> > <const1>|<field1> AND
<field>|<const> < <const2>|<field2>
or actually in prefix format
BEGIN(AND) GT(<field>|<const>, <const1>|<field1>),
LT(<field>|<const>, <const2>|<field2>), END()
*/
if (rewrite_context->count == 2)
{
// Lower limit of BETWEEN
DBUG_PRINT("info", ("GE_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::GE_FUNC, 2);
}
else if (rewrite_context->count == 3)
{
// Upper limit of BETWEEN
DBUG_PRINT("info", ("LE_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::LE_FUNC, 2);
}
else
{
// Illegal BETWEEN expression
DBUG_PRINT("info", ("Illegal BETWEEN expression"));
context->supported= FALSE;
DBUG_VOID_RETURN;
}
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::IN_FUNC:
{
/*
Rewrite <field>|<const> IN(<const1>|<field1>, <const2>|<field2>,..)
to <field>|<const> = <const1>|<field1> OR
<field> = <const2>|<field2> ...
or actually in prefix format
BEGIN(OR) EQ(<field>|<const>, <const1><field1>),
EQ(<field>|<const>, <const2>|<field2>), ... END()
Each part of the disjunction is added for each call
to ndb_serialize_cond and end of rewrite statement
is wrapped in end of ndb_serialize_cond
*/
DBUG_PRINT("info", ("EQ_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::EQ_FUNC, 2);
break;
}
default:
context->supported= FALSE;
}
// Handle left hand <field>|<const>
context->rewrite_stack= NULL; // Disable rewrite mode
context->expect_only(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
context->expect(Item::INT_ITEM);
context->expect(Item::STRING_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FUNC_ITEM);
ndb_serialize_cond(rewrite_context->left_hand_item, arg);
context->skip= 0; // Any FUNC_ITEM expression has already been parsed
context->rewrite_stack= rewrite_context; // Enable rewrite mode
if (!context->supported)
DBUG_VOID_RETURN;
prev_cond= context->cond_ptr;
curr_cond= context->cond_ptr= new Ndb_cond();
prev_cond->next= curr_cond;
}
// Check for end of AND/OR expression
if (!item)
{
// End marker for condition group
DBUG_PRINT("info", ("End of condition group"));
curr_cond->ndb_item= new Ndb_item(NDB_END_COND);
}
else
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
switch (item->type()) {
case Item::FIELD_ITEM:
{
Item_field *field_item= (Item_field *) item;
Field *field= field_item->field;
enum_field_types type= field->type();
/*
Check that the field is part of the table of the handler
instance and that we expect a field with of this result type.
*/
if (context->table == field->table)
{
const NDBTAB *tab= (const NDBTAB *) context->ndb_table;
DBUG_PRINT("info", ("FIELD_ITEM"));
DBUG_PRINT("info", ("table %s", tab->getName()));
DBUG_PRINT("info", ("column %s", field->field_name));
DBUG_PRINT("info", ("result type %d", field->result_type()));
// Check that we are expecting a field and with the correct
// result type
if (context->expecting(Item::FIELD_ITEM) &&
(context->expecting_field_result(field->result_type()) ||
2005-07-31 21:33:46 +02:00
// Date and year can be written as string or int
((type == MYSQL_TYPE_TIME ||
type == MYSQL_TYPE_DATE ||
type == MYSQL_TYPE_YEAR ||
type == MYSQL_TYPE_DATETIME)
2005-07-31 21:33:46 +02:00
? (context->expecting_field_result(STRING_RESULT) ||
context->expecting_field_result(INT_RESULT))
: true)) &&
// Bit fields no yet supported in scan filter
type != MYSQL_TYPE_BIT)
{
const NDBCOL *col= tab->getColumn(field->field_name);
DBUG_ASSERT(col);
curr_cond->ndb_item= new Ndb_item(field, col->getColumnNo());
context->dont_expect(Item::FIELD_ITEM);
context->expect_no_field_result();
if (context->expect_mask)
{
// We have not seen second argument yet
if (type == MYSQL_TYPE_TIME ||
type == MYSQL_TYPE_DATE ||
type == MYSQL_TYPE_YEAR ||
type == MYSQL_TYPE_DATETIME)
{
context->expect_only(Item::STRING_ITEM);
context->expect(Item::INT_ITEM);
}
else
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (field->result_type()) {
case STRING_RESULT:
// Expect char string or binary string
context->expect_only(Item::STRING_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect_collation(field_item->collation.collation);
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case REAL_RESULT:
context->expect_only(Item::REAL_ITEM);
context->expect(Item::DECIMAL_ITEM);
context->expect(Item::INT_ITEM);
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case INT_RESULT:
context->expect_only(Item::INT_ITEM);
context->expect(Item::VARBIN_ITEM);
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case DECIMAL_RESULT:
context->expect_only(Item::DECIMAL_ITEM);
context->expect(Item::REAL_ITEM);
context->expect(Item::INT_ITEM);
break;
default:
break;
}
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
// Check that field and string constant collations are the same
if ((field->result_type() == STRING_RESULT) &&
!context->expecting_collation(item->collation.collation)
&& type != MYSQL_TYPE_TIME
&& type != MYSQL_TYPE_DATE
&& type != MYSQL_TYPE_YEAR
&& type != MYSQL_TYPE_DATETIME)
{
DBUG_PRINT("info", ("Found non-matching collation %s",
item->collation.collation->name));
context->supported= FALSE;
}
}
break;
}
else
{
2005-07-31 21:33:46 +02:00
DBUG_PRINT("info", ("Was not expecting field of type %u(%u)",
field->result_type(), type));
context->supported= FALSE;
}
}
else
{
Table definition cache, part 2 The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table mysql-test/mysql-test-run.sh: Fixed some problems with --gdb option Test both with socket and tcp/ip port that all old servers are killed mysql-test/r/flush_table.result: More tests with lock table with 2 threads + flush table mysql-test/r/information_schema.result: Removed old (now wrong) result mysql-test/r/innodb.result: Better error messages (thanks to TDC patch) mysql-test/r/merge.result: Extra flush table test mysql-test/r/ndb_bitfield.result: Better error messages (thanks to TDC patch) mysql-test/r/ndb_partition_error.result: Better error messages (thanks to TDC patch) mysql-test/r/query_cache.result: Remove tables left from old tests mysql-test/r/temp_table.result: Test truncate with temporary tables mysql-test/r/variables.result: Table_cache -> Table_open_cache mysql-test/t/flush_table.test: More tests with lock table with 2 threads + flush table mysql-test/t/merge.test: Extra flush table test mysql-test/t/multi_update.test: Added 'sleep' to make test predictable mysql-test/t/query_cache.test: Remove tables left from old tests mysql-test/t/temp_table.test: Test truncate with temporary tables mysql-test/t/variables.test: Table_cache -> Table_open_cache mysql-test/valgrind.supp: Remove warning that may happens becasue threads dies in different order mysys/hash.c: Fixed wrong DBUG_PRINT mysys/mf_dirname.c: More DBUG mysys/mf_pack.c: Better comment mysys/mf_tempdir.c: More DBUG Ensure that we call cleanup_dirname() on all temporary directory paths. If we don't do this, we will get a failure when comparing temporary table names as in some cases the temporary table name is run through convert_dirname()) mysys/my_alloc.c: Indentation fix sql/examples/ha_example.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_example.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/examples/ha_tina.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/field.cc: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Use s->db instead of s->table_cache_key - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/field.h: Update for table definition cache: - Field creation now takes TABLE_SHARE instead of TABLE as argument (This is becasue field definitions are now cached in TABLE_SHARE) When a field is created, one now must call field->init(TABLE) before using it - Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE - make_field() takes TABLE_SHARE as argument instead of TABLE - move_field() -> move_field_offset() sql/ha_archive.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_archive.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_berkeley.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Changed name of argument create() to not hide internal 'table' variable. table->s -> table_share sql/ha_berkeley.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_blackhole.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_federated.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed comments Remove index variable and replace with pointers (simple optimization) move_field() -> move_field_offset() Removed some strlen() calls sql/ha_federated.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_heap.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Simplify delete_table() and create() as the given file names are now without extension sql/ha_heap.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_innodb.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisam.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Remove not needed fn_format() Fixed for new table->s structure sql/ha_myisam.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_myisammrg.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Don't set 'is_view' for MERGE tables Use new interface to find_temporary_table() sql/ha_myisammrg.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Added flag HA_NO_COPY_ON_ALTER sql/ha_ndbcluster.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers Fixed wrong calls to strxnmov() Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed drop_table -> intern_drop_table() table->s -> table_share Move part_info to TABLE Fixed comments & DBUG print's New arguments to print_error() sql/ha_ndbcluster.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers sql/ha_partition.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers We can't set up or use part_info when creating handler as there is not yet any table object New ha_intialise() to work with TDC (Done by Mikael) sql/ha_partition.h: We new use TABLE_SHARE instead of TABLE when creating engine handlers Got set_part_info() from Mikael sql/handler.cc: We new use TABLE_SHARE instead of TABLE when creating engine handlers ha_delete_table() now also takes database as an argument handler::ha_open() now takes TABLE as argument ha_open() now calls ha_allocate_read_write_set() Simplify ha_allocate_read_write_set() Remove ha_deallocate_read_write_set() Use table_share (Cached by table definition cache) sql/handler.h: New table flag: HA_NO_COPY_ON_ALTER (used by merge tables) Remove ha_deallocate_read_write_set() get_new_handler() now takes TABLE_SHARE as argument ha_delete_table() now gets database as argument sql/item.cc: table_name and db are now LEX_STRING objects When creating fields, we have now have to call field->init(table) move_field -> move_field_offset() sql/item.h: tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR instead of BLOB sql/item_cmpfunc.cc: Fixed call to tmp_table_field_from_field_type() sql/item_create.cc: Assert if new not handled cast type sql/item_func.cc: When creating fields, we have now have to call field->init(table) dummy_table used by 'sp' now needs a TABLE_SHARE object sql/item_subselect.cc: Trivial code cleanups sql/item_sum.cc: When creating fields, we have now have to call field->init(table) sql/item_timefunc.cc: Item_func_str_to_date::tmp_table_field() now replaced by call to tmp_table_field_from_field_type() (see item_timefunc.h) sql/item_timefunc.h: Simply tmp_table_field() sql/item_uniq.cc: When creating fields, we have now have to call field->init(table) sql/key.cc: Added 'KEY' argument to 'find_ref_key' to simplify code sql/lock.cc: More debugging Use create_table_def_key() to create key for table cache Allocate TABLE_SHARE properly when creating name lock Fix that locked_table_name doesn't test same table twice sql/mysql_priv.h: New functions for table definition cache New interfaces to a lot of functions. New faster interface to find_temporary_table() and close_temporary_table() sql/mysqld.cc: Added support for table definition cache of size 'table_def_size' Fixed som calls to strnmov() Changed name of 'table_cache' to 'table_open_cache' sql/opt_range.cc: Use new interfaces Fixed warnings from valgrind sql/parse_file.cc: Safer calls to strxnmov() Fixed typo sql/set_var.cc: Added variable 'table_definition_cache' Variable table_cache renamed to 'table_open_cache' sql/slave.cc: Use new interface sql/sp.cc: Proper use of TABLE_SHARE sql/sp_head.cc: Remove compiler warnings We have now to call field->init(table) sql/sp_head.h: Pointers to parsed strings are now const sql/sql_acl.cc: table_name is now a LEX_STRING sql/sql_base.cc: Main implementation of table definition cache (The #ifdef's are there for the future when table definition cache will replace open table cache) Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places Views are not yet cached; For the moment we only cache if a table is a view or not. Faster implementation of find_temorary_table() Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()' Drop table is slightly faster as we can use the table definition cache to know the type of the table sql/sql_cache.cc: table_cache_key and table_name are now LEX_STRING 'sDBUG print fixes sql/sql_class.cc: table_cache_key is now a LEX_STRING safer strxnmov() sql/sql_class.h: Added number of open table shares (table definitions) sql/sql_db.cc: safer strxnmov() sql/sql_delete.cc: Use new interface to find_temporary_table() sql/sql_derived.cc: table_name is now a LEX_STRING sql/sql_handler.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_insert.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's sql/sql_lex.cc: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_lex.h: Make parsed string a const (to quickly find out if anything is trying to change the query string) sql/sql_load.cc: Safer strxnmov() sql/sql_parse.cc: Better error if wrong DB name sql/sql_partition.cc: part_info moved to TABLE from TABLE_SHARE Indentation changes sql/sql_select.cc: Indentation fixes Call field->init(TABLE) for new created fields Update create_tmp_table() to use TABLE_SHARE properly sql/sql_select.h: Call field->init(TABLE) for new created fields sql/sql_show.cc: table_name is now a LEX_STRING part_info moved to TABLE sql/sql_table.cc: Use table definition cache to speed up delete of tables Fixed calls to functions with new interfaces Don't use 'share_not_to_be_used' Instead of doing openfrm() when doing repair, we now have to call get_table_share() followed by open_table_from_share(). Replace some fn_format() with faster unpack_filename(). Safer strxnmov() part_info is now in TABLE Added Mikaels patch for partition and ALTER TABLE Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER sql/sql_test.cc: table_name and table_cache_key are now LEX_STRING's sql/sql_trigger.cc: TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's safer strxnmov() Removed compiler warnings sql/sql_update.cc: Call field->init(TABLE) after field is created sql/sql_view.cc: safer strxnmov() Create common TABLE_SHARE object for views to allow us to cache if table is a view sql/structs.h: Added SHOW_TABLE_DEFINITIONS sql/table.cc: Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats sql/table.h: TABLE objects for the same database table now share a common TABLE_SHARE object In TABLE_SHARE the most common strings are now LEX_STRING's sql/unireg.cc: Changed arguments to rea_create_table() to have same order as other functions Call field->init(table) for new created fields sql/unireg.h: Added OPEN_VIEW strings/strxnmov.c: Change strxnmov() to always add end \0 This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
DBUG_PRINT("info", ("Was not expecting field from table %s (%s)",
context->table->s->table_name.str,
field->table->s->table_name.str));
context->supported= FALSE;
}
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::FUNC_ITEM:
{
Item_func *func_item= (Item_func *) item;
// Check that we expect a function or functional expression here
if (context->expecting(Item::FUNC_ITEM) ||
func_item->functype() == Item_func::UNKNOWN_FUNC)
context->expect_nothing();
else
{
// Did not expect function here
context->supported= FALSE;
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (func_item->functype()) {
case Item_func::EQ_FUNC:
{
DBUG_PRINT("info", ("EQ_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::REAL_ITEM);
context->expect(Item::DECIMAL_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::NE_FUNC:
{
DBUG_PRINT("info", ("NE_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::REAL_ITEM);
context->expect(Item::DECIMAL_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::LT_FUNC:
{
DBUG_PRINT("info", ("LT_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::REAL_ITEM);
context->expect(Item::DECIMAL_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::LE_FUNC:
{
DBUG_PRINT("info", ("LE_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::REAL_ITEM);
context->expect(Item::DECIMAL_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::GE_FUNC:
{
DBUG_PRINT("info", ("GE_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::REAL_ITEM);
context->expect(Item::DECIMAL_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::GT_FUNC:
{
DBUG_PRINT("info", ("GT_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::REAL_ITEM);
context->expect(Item::DECIMAL_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::LIKE_FUNC:
{
DBUG_PRINT("info", ("LIKE_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect(Item::FUNC_ITEM);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::ISNULL_FUNC:
{
DBUG_PRINT("info", ("ISNULL_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::ISNOTNULL_FUNC:
{
DBUG_PRINT("info", ("ISNOTNULL_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::FIELD_ITEM);
context->expect_field_result(STRING_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(INT_RESULT);
context->expect_field_result(DECIMAL_RESULT);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::NOT_FUNC:
{
DBUG_PRINT("info", ("NOT_FUNC"));
curr_cond->ndb_item= new Ndb_item(func_item->functype(),
func_item);
context->expect(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::BETWEEN:
{
DBUG_PRINT("info", ("BETWEEN, rewriting using AND"));
Item_func_between *between_func= (Item_func_between *) func_item;
Ndb_rewrite_context *rewrite_context=
new Ndb_rewrite_context(func_item);
rewrite_context->next= context->rewrite_stack;
context->rewrite_stack= rewrite_context;
if (between_func->negated)
{
DBUG_PRINT("info", ("NOT_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::NOT_FUNC, 1);
prev_cond= curr_cond;
curr_cond= context->cond_ptr= new Ndb_cond();
curr_cond->prev= prev_cond;
prev_cond->next= curr_cond;
}
DBUG_PRINT("info", ("COND_AND_FUNC"));
curr_cond->ndb_item=
new Ndb_item(Item_func::COND_AND_FUNC,
func_item->argument_count() - 1);
context->expect_only(Item::FIELD_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::STRING_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FUNC_ITEM);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::IN_FUNC:
{
DBUG_PRINT("info", ("IN_FUNC, rewriting using OR"));
Item_func_in *in_func= (Item_func_in *) func_item;
Ndb_rewrite_context *rewrite_context=
new Ndb_rewrite_context(func_item);
rewrite_context->next= context->rewrite_stack;
context->rewrite_stack= rewrite_context;
if (in_func->negated)
{
DBUG_PRINT("info", ("NOT_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::NOT_FUNC, 1);
prev_cond= curr_cond;
curr_cond= context->cond_ptr= new Ndb_cond();
curr_cond->prev= prev_cond;
prev_cond->next= curr_cond;
}
DBUG_PRINT("info", ("COND_OR_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::COND_OR_FUNC,
func_item->argument_count() - 1);
context->expect_only(Item::FIELD_ITEM);
context->expect(Item::INT_ITEM);
context->expect(Item::STRING_ITEM);
context->expect(Item::VARBIN_ITEM);
context->expect(Item::FUNC_ITEM);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::UNKNOWN_FUNC:
{
DBUG_PRINT("info", ("UNKNOWN_FUNC %s",
func_item->const_item()?"const":""));
DBUG_PRINT("info", ("result type %d", func_item->result_type()));
if (func_item->const_item())
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
switch (func_item->result_type()) {
case STRING_RESULT:
{
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::STRING_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(STRING_RESULT);
context->expect_collation(func_item->collation.collation);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
// Check that string result have correct collation
if (!context->expecting_collation(item->collation.collation))
{
DBUG_PRINT("info", ("Found non-matching collation %s",
item->collation.collation->name));
context->supported= FALSE;
}
}
// Skip any arguments since we will evaluate function instead
DBUG_PRINT("info", ("Skip until end of arguments marker"));
context->skip= func_item->argument_count();
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case REAL_RESULT:
{
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::REAL_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(REAL_RESULT);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
}
// Skip any arguments since we will evaluate function instead
DBUG_PRINT("info", ("Skip until end of arguments marker"));
context->skip= func_item->argument_count();
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case INT_RESULT:
{
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::INT_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(INT_RESULT);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
}
// Skip any arguments since we will evaluate function instead
DBUG_PRINT("info", ("Skip until end of arguments marker"));
context->skip= func_item->argument_count();
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case DECIMAL_RESULT:
{
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::DECIMAL_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(DECIMAL_RESULT);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
}
// Skip any arguments since we will evaluate function instead
DBUG_PRINT("info", ("Skip until end of arguments marker"));
context->skip= func_item->argument_count();
break;
}
default:
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
}
else
// Function does not return constant expression
context->supported= FALSE;
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
default:
{
DBUG_PRINT("info", ("Found func_item of type %d",
func_item->functype()));
context->supported= FALSE;
}
}
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::STRING_ITEM:
DBUG_PRINT("info", ("STRING_ITEM"));
if (context->expecting(Item::STRING_ITEM))
{
#ifndef DBUG_OFF
char buff[256];
String str(buff,(uint32) sizeof(buff), system_charset_info);
str.length(0);
Item_string *string_item= (Item_string *) item;
DBUG_PRINT("info", ("value \"%s\"",
string_item->val_str(&str)->ptr()));
#endif
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::STRING_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(STRING_RESULT);
context->expect_collation(item->collation.collation);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
// Check that we are comparing with a field with same collation
if (!context->expecting_collation(item->collation.collation))
{
DBUG_PRINT("info", ("Found non-matching collation %s",
item->collation.collation->name));
context->supported= FALSE;
}
}
}
else
context->supported= FALSE;
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::INT_ITEM:
DBUG_PRINT("info", ("INT_ITEM"));
if (context->expecting(Item::INT_ITEM))
{
Item_int *int_item= (Item_int *) item;
DBUG_PRINT("info", ("value %d", int_item->value));
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::INT_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(INT_RESULT);
context->expect_field_result(REAL_RESULT);
context->expect_field_result(DECIMAL_RESULT);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
}
}
else
context->supported= FALSE;
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::REAL_ITEM:
DBUG_PRINT("info", ("REAL_ITEM %s"));
if (context->expecting(Item::REAL_ITEM))
{
Item_float *float_item= (Item_float *) item;
DBUG_PRINT("info", ("value %f", float_item->value));
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::REAL_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(REAL_RESULT);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
}
}
else
context->supported= FALSE;
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::VARBIN_ITEM:
DBUG_PRINT("info", ("VARBIN_ITEM"));
if (context->expecting(Item::VARBIN_ITEM))
{
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::VARBIN_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(STRING_RESULT);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
}
}
else
context->supported= FALSE;
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::DECIMAL_ITEM:
DBUG_PRINT("info", ("DECIMAL_ITEM %s"));
if (context->expecting(Item::DECIMAL_ITEM))
{
Item_decimal *decimal_item= (Item_decimal *) item;
DBUG_PRINT("info", ("value %f", decimal_item->val_real()));
NDB_ITEM_QUALIFICATION q;
q.value_type= Item::DECIMAL_ITEM;
curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
if (context->expect_field_result_mask)
{
// We have not seen the field argument yet
context->expect_only(Item::FIELD_ITEM);
context->expect_only_field_result(REAL_RESULT);
context->expect_field_result(DECIMAL_RESULT);
}
else
{
// Expect another logical expression
context->expect_only(Item::FUNC_ITEM);
context->expect(Item::COND_ITEM);
}
}
else
context->supported= FALSE;
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item::COND_ITEM:
{
Item_cond *cond_item= (Item_cond *) item;
if (context->expecting(Item::COND_ITEM))
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
switch (cond_item->functype()) {
case Item_func::COND_AND_FUNC:
DBUG_PRINT("info", ("COND_AND_FUNC"));
curr_cond->ndb_item= new Ndb_item(cond_item->functype(),
cond_item);
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case Item_func::COND_OR_FUNC:
DBUG_PRINT("info", ("COND_OR_FUNC"));
curr_cond->ndb_item= new Ndb_item(cond_item->functype(),
cond_item);
break;
default:
DBUG_PRINT("info", ("COND_ITEM %d", cond_item->functype()));
context->supported= FALSE;
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
}
else
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
/* Did not expect condition */
context->supported= FALSE;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
}
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
default:
{
DBUG_PRINT("info", ("Found item of type %d", item->type()));
context->supported= FALSE;
}
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
}
if (context->supported && context->rewrite_stack)
{
Ndb_rewrite_context *rewrite_context= context->rewrite_stack;
if (rewrite_context->count ==
rewrite_context->func_item->argument_count())
{
// Rewrite is done, wrap an END() at the en
DBUG_PRINT("info", ("End of condition group"));
prev_cond= curr_cond;
curr_cond= context->cond_ptr= new Ndb_cond();
curr_cond->prev= prev_cond;
prev_cond->next= curr_cond;
curr_cond->ndb_item= new Ndb_item(NDB_END_COND);
// Pop rewrite stack
context->rewrite_stack= context->rewrite_stack->next;
}
2004-12-17 21:13:22 +01:00
}
}
2004-12-17 21:13:22 +01:00
}
2004-12-17 21:13:22 +01:00
DBUG_VOID_RETURN;
}
bool
ha_ndbcluster::serialize_cond(const COND *cond, Ndb_cond_stack *ndb_cond)
{
DBUG_ENTER("serialize_cond");
Item *item= (Item *) cond;
Ndb_cond_traverse_context context(table, (void *)m_table, ndb_cond);
// Expect a logical expression
context.expect(Item::FUNC_ITEM);
context.expect(Item::COND_ITEM);
2004-12-17 21:13:22 +01:00
item->traverse_cond(&ndb_serialize_cond, (void *) &context, Item::PREFIX);
DBUG_PRINT("info", ("The pushed condition is %ssupported", (context.supported)?"":"not "));
2004-12-17 21:13:22 +01:00
DBUG_RETURN(context.supported);
2004-12-17 21:13:22 +01:00
}
int
ha_ndbcluster::build_scan_filter_predicate(Ndb_cond * &cond,
NdbScanFilter *filter,
bool negated)
2004-12-17 21:13:22 +01:00
{
DBUG_ENTER("build_scan_filter_predicate");
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (cond->ndb_item->type) {
case NDB_FUNCTION:
{
2004-12-17 21:13:22 +01:00
if (!cond->next)
break;
Ndb_item *a= cond->next->ndb_item;
Ndb_item *b, *field, *value= NULL;
Fixes during review of new pushed code Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/ha_berkeley.cc: Removed not used variable (and options) sql/ha_berkeley.h: Removed not used argument sql/ha_ndbcluster.cc: Remove compiler warning sql/init.cc: Simplify code sql/item_sum.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/mysql_priv.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/mysqld.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_class.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_delete.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_derived.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_lex.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_parse.cc: Indentation fixes sql/sql_select.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_select.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_show.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_union.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_update.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_yacc.yy: Changed variable name i to more descriptive name Removed compiler warning
2005-08-12 12:54:42 +02:00
LINT_INIT(field);
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (cond->ndb_item->argument_count()) {
case 1:
field=
(a->type == NDB_FIELD)? a : NULL;
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
case 2:
2004-12-17 21:13:22 +01:00
if (!cond->next->next)
break;
b= cond->next->next->ndb_item;
value=
(a->type == NDB_VALUE)? a
: (b->type == NDB_VALUE)? b
: NULL;
field=
(a->type == NDB_FIELD)? a
: (b->type == NDB_FIELD)? b
: NULL;
break;
2005-03-09 16:39:23 +01:00
default:
2005-07-18 13:31:02 +02:00
field= NULL; //Keep compiler happy
DBUG_ASSERT(0);
break;
}
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch ((negated) ?
Ndb_item::negate(cond->ndb_item->qualification.function_type)
: cond->ndb_item->qualification.function_type) {
case NDB_EQ_FUNC:
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
DBUG_PRINT("info", ("Generating EQ filter"));
if (filter->cmp(NdbScanFilter::COND_EQ,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_NE_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
DBUG_PRINT("info", ("Generating NE filter"));
if (filter->cmp(NdbScanFilter::COND_NE,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_LT_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
2004-12-17 21:13:22 +01:00
if (a == field)
{
DBUG_PRINT("info", ("Generating LT filter"));
if (filter->cmp(NdbScanFilter::COND_LT,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
2004-12-17 21:13:22 +01:00
else
{
DBUG_PRINT("info", ("Generating GT filter"));
if (filter->cmp(NdbScanFilter::COND_GT,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_LE_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
2004-12-17 21:13:22 +01:00
if (a == field)
{
DBUG_PRINT("info", ("Generating LE filter"));
if (filter->cmp(NdbScanFilter::COND_LE,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
2004-12-17 21:13:22 +01:00
else
{
DBUG_PRINT("info", ("Generating GE filter"));
if (filter->cmp(NdbScanFilter::COND_GE,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_GE_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
2004-12-17 21:13:22 +01:00
if (a == field)
{
DBUG_PRINT("info", ("Generating GE filter"));
if (filter->cmp(NdbScanFilter::COND_GE,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
2004-12-17 21:13:22 +01:00
else
{
DBUG_PRINT("info", ("Generating LE filter"));
if (filter->cmp(NdbScanFilter::COND_LE,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_GT_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
2004-12-17 21:13:22 +01:00
if (a == field)
{
DBUG_PRINT("info", ("Generating GT filter"));
if (filter->cmp(NdbScanFilter::COND_GT,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
2004-12-17 21:13:22 +01:00
else
{
DBUG_PRINT("info", ("Generating LT filter"));
if (filter->cmp(NdbScanFilter::COND_LT,
field->get_field_no(),
field->get_val(),
field->pack_length()) == -1)
DBUG_RETURN(1);
}
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_LIKE_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
if ((value->qualification.value_type != Item::STRING_ITEM) &&
(value->qualification.value_type != Item::VARBIN_ITEM))
break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
DBUG_PRINT("info", ("Generating LIKE filter: like(%d,%s,%d)",
field->get_field_no(), value->get_val(),
value->pack_length()));
if (filter->cmp(NdbScanFilter::COND_LIKE,
field->get_field_no(),
value->get_val(),
value->pack_length()) == -1)
DBUG_RETURN(1);
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_NOTLIKE_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
2004-12-17 21:13:22 +01:00
if (!value || !field) break;
if ((value->qualification.value_type != Item::STRING_ITEM) &&
(value->qualification.value_type != Item::VARBIN_ITEM))
break;
2005-02-11 22:05:24 +01:00
// Save value in right format for the field type
value->save_in_field(field);
DBUG_PRINT("info", ("Generating NOTLIKE filter: notlike(%d,%s,%d)",
field->get_field_no(), value->get_val(),
value->pack_length()));
if (filter->cmp(NdbScanFilter::COND_NOT_LIKE,
field->get_field_no(),
value->get_val(),
value->pack_length()) == -1)
DBUG_RETURN(1);
cond= cond->next->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
case NDB_ISNULL_FUNC:
if (!field)
break;
DBUG_PRINT("info", ("Generating ISNULL filter"));
if (filter->isnull(field->get_field_no()) == -1)
DBUG_RETURN(1);
cond= cond->next->next;
DBUG_RETURN(0);
case NDB_ISNOTNULL_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
if (!field)
break;
DBUG_PRINT("info", ("Generating ISNOTNULL filter"));
if (filter->isnotnull(field->get_field_no()) == -1)
DBUG_RETURN(1);
cond= cond->next->next;
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
default:
break;
}
break;
}
default:
break;
}
DBUG_PRINT("info", ("Found illegal condition"));
DBUG_RETURN(1);
2004-12-17 21:13:22 +01:00
}
int
ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter)
2004-12-17 21:13:22 +01:00
{
uint level=0;
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
bool negated= FALSE;
2004-12-17 21:13:22 +01:00
DBUG_ENTER("build_scan_filter_group");
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
do
{
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
if (!cond)
DBUG_RETURN(1);
switch (cond->ndb_item->type) {
case NDB_FUNCTION:
{
switch (cond->ndb_item->qualification.function_type) {
case NDB_COND_AND_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
level++;
DBUG_PRINT("info", ("Generating %s group %u", (negated)?"NAND":"AND",
level));
if ((negated) ? filter->begin(NdbScanFilter::NAND)
: filter->begin(NdbScanFilter::AND) == -1)
DBUG_RETURN(1);
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
negated= FALSE;
cond= cond->next;
break;
}
case NDB_COND_OR_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
level++;
DBUG_PRINT("info", ("Generating %s group %u", (negated)?"NOR":"OR",
level));
if ((negated) ? filter->begin(NdbScanFilter::NOR)
: filter->begin(NdbScanFilter::OR) == -1)
DBUG_RETURN(1);
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
negated= FALSE;
cond= cond->next;
break;
}
case NDB_NOT_FUNC:
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
{
DBUG_PRINT("info", ("Generating negated query"));
cond= cond->next;
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
negated= TRUE;
break;
}
default:
if (build_scan_filter_predicate(cond, filter, negated))
DBUG_RETURN(1);
Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment
2005-05-06 10:39:30 +02:00
negated= FALSE;
break;
}
break;
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
}
case NDB_END_COND:
DBUG_PRINT("info", ("End of group %u", level));
level--;
if (cond) cond= cond->next;
if (filter->end() == -1)
DBUG_RETURN(1);
if (!negated)
break;
// else fall through (NOT END is an illegal condition)
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
default:
{
DBUG_PRINT("info", ("Illegal scan filter"));
}
2004-12-17 21:13:22 +01:00
}
} while (level > 0 || negated);
2004-12-17 21:13:22 +01:00
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
int
ha_ndbcluster::build_scan_filter(Ndb_cond * &cond, NdbScanFilter *filter)
2004-12-17 21:13:22 +01:00
{
bool simple_cond= TRUE;
DBUG_ENTER("build_scan_filter");
Fixes during review of new code - Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
2005-07-04 02:42:33 +02:00
switch (cond->ndb_item->type) {
case NDB_FUNCTION:
switch (cond->ndb_item->qualification.function_type) {
case NDB_COND_AND_FUNC:
case NDB_COND_OR_FUNC:
simple_cond= FALSE;
break;
default:
break;
}
break;
default:
break;
}
if (simple_cond && filter->begin() == -1)
DBUG_RETURN(1);
if (build_scan_filter_group(cond, filter))
DBUG_RETURN(1);
if (simple_cond && filter->end() == -1)
DBUG_RETURN(1);
2004-12-17 21:13:22 +01:00
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
int
2004-12-17 21:13:22 +01:00
ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack,
NdbScanOperation *op)
2004-12-17 21:13:22 +01:00
{
DBUG_ENTER("generate_scan_filter");
if (ndb_cond_stack)
{
DBUG_PRINT("info", ("Generating scan filter"));
2004-12-17 21:13:22 +01:00
NdbScanFilter filter(op);
bool multiple_cond= FALSE;
// Wrap an AND group around multiple conditions
if (ndb_cond_stack->next) {
multiple_cond= TRUE;
if (filter.begin() == -1)
DBUG_RETURN(1);
2004-12-17 21:13:22 +01:00
}
for (Ndb_cond_stack *stack= ndb_cond_stack;
(stack);
stack= stack->next)
2004-12-17 21:13:22 +01:00
{
Ndb_cond *cond= stack->ndb_cond;
if (build_scan_filter(cond, &filter))
{
DBUG_PRINT("info", ("build_scan_filter failed"));
DBUG_RETURN(1);
}
2004-12-17 21:13:22 +01:00
}
if (multiple_cond && filter.end() == -1)
DBUG_RETURN(1);
2004-12-17 21:13:22 +01:00
}
else
{
DBUG_PRINT("info", ("Empty stack"));
}
DBUG_RETURN(0);
2004-12-17 21:13:22 +01:00
}
/*
Implements the SHOW NDB STATUS command.
*/
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
bool
ndbcluster_show_status(THD* thd, stat_print_fn *stat_print,
enum ha_stat_type stat_type)
{
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
char buf[IO_SIZE];
DBUG_ENTER("ndbcluster_show_status");
if (have_ndbcluster != SHOW_OPTION_YES)
{
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
DBUG_RETURN(FALSE);
}
if (stat_type != HA_ENGINE_STATUS)
{
DBUG_RETURN(FALSE);
}
if (get_thd_ndb(thd) && get_thd_ndb(thd)->ndb)
{
Ndb* ndb= (get_thd_ndb(thd))->ndb;
Review fixes of new pushed code - Fixed tests - Optimized new code - Fixed some unlikely core dumps - Better bug fixes for: - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null mysql-test/r/create.result: Update results after removing wrong warnings for CREATE ... SELECT New tests mysql-test/r/handler.result: Drop used tables mysql-test/r/kill.result: Make test portable mysql-test/r/mysqlshow.result: Drop tables used by previous test mysql-test/r/trigger.result: Reuse old procedure name mysql-test/r/view.result: Extra tests mysql-test/t/create.test: New tests to test fix of removing wrong warnings for CREATE ... SELECT mysql-test/t/disabled.def: Enable 'kill' test (should now be portable) mysql-test/t/handler.test: Drop used tables mysql-test/t/kill.test: Make test portable even if kill doesn't work at once mysql-test/t/mysqlshow.test: Drop tables used by previous test mysql-test/t/trigger.test: Reuse old procedure name mysql-test/t/view.test: Extra tests sql/field.cc: Removed compiler warning sql/ha_federated.cc: my_snprintf -> strmake() (Simple optimization) sql/ha_ndbcluster.cc: Indentation cleanups and trival optimization sql/item.cc: Moved save_org_in_field() to item.cc to make it easier to test Remove setting of null_value as this is not needed sql/item.h: Moved save_org_in_field() to item.cc to make it easier to test sql/log_event.cc: Remove inline of slave_load_file_stem() Added 'extension' parameter to slave_load_file_stem() to get smaller code Removed not critical (or needed) DBUG_ASSERT()'s Cleaned up usage of slave_load_file_stem() to not depend on constant string lengths Indentation fixes sql/opt_range.cc: Moved code from declaration to function body (To make it more readable) sql/parse_file.cc: Fixed DBUG_PRINT sql/sp.cc: Simple cleanups - Removed not needed {} level - Ensure saved variables starts with old_ sql/sp_head.cc: Indentation fixes Remove core dump when using --debug when m_next_cached_sp == 0 Fixed compiler warnings Trivial optimizations sql/sp_head.h: Changed argument to set_definer() to const Added THD argument to recursion_level_error() to avoid call to current_thd sql/sql_acl.cc: Removed not needed test (first_not_own_table is the guard) sql/sql_base.cc: Removed extra empty line sql/sql_handler.cc: Don't test table version in mysql_ha_read() as this is already tested in lock_tables() Moved call to insert_fields to be after lock_table() to guard aganst reopen of tables (Better fix for Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash) sql/sql_insert.cc: Mark fields that are set in CREATE ... SELECT as used (Removed wrong warnings about field not having a default value) sql/sql_parse.cc: Removed not needed test of 'tables' (first_not_own_table is the guard) Simplify code sql/sql_select.cc: Use group->field to check if value is null instead of item called by 'save_org_in_field' This is a better bug fix for #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null) sql/sql_trigger.cc: Move sql_modes_parameters outside of function Indentation fixes Fixed compiler warning Ensure that thd->lex->query_tables_own_last is set properly before calling check_table_access() (This allows us to remove the extra test in check_grant() and check_table_access())
2006-01-05 23:47:49 +01:00
Ndb::Free_list_usage tmp;
tmp.m_name= 0;
while (ndb->get_free_list_usage(&tmp))
{
Finalize storage engine plugins Give BerkeleyDB savepoints Remove "enum db_type" from most of the code storage/example/ha_example.h: Rename: sql/examples/ha_example.h -> storage/example/ha_example.h storage/csv/ha_tina.h: Rename: sql/examples/ha_tina.h -> storage/csv/ha_tina.h config/ac-macros/storage.m4: if hton name is "no", then we don't install it as a builtin configure.in: pluggable changes include/plugin.h: version field mysql-test/r/bdb.result: savepoint results copied from innodb test mysql-test/r/information_schema.result: PLUGINS information schema mysql-test/r/information_schema_db.result: PLUGINS information schema mysql-test/t/bdb.test: savepoint test copied from innodb test sql/Makefile.am: tina and example are not here anymore sql/authors.h: minor tweek sql/ha_archive.cc: remove unwanted handlerton entries sql/ha_berkeley.cc: remove unwanted handlerton entries support for savepoints changes to show logs sql/ha_blackhole.cc: remove unwanted handlerton entries sql/ha_federated.cc: remove unwanted handlerton entries sql/ha_heap.cc: remove unwanted handlerton entries sql/ha_innodb.cc: remove unwanted handlerton entries changes for show status sql/ha_myisam.cc: remove unwanted handlerton entries sql/ha_myisammrg.cc: remove unwanted handlerton entries sql/ha_ndbcluster.cc: remove unwanted handlerton entries changes to stat_print sql/ha_partition.cc: remove unwanted handlerton entries bye bye enum db_type sql/ha_partition.h: bye bye enum db_type sql/handler.cc: remove unwanted handlerton entries bye bye enum db_type sql/handler.h: remove unwanted handlerton entries bye bye enum db_type changes to stat_print_fn sql/item_sum.cc: bye bye enum db_type sql/log.cc: remove unwanted handlerton entries sql/mysql_priv.h: bye bye enum db_type sql/mysqld.cc: bye bye enum db_type reorder plugin initialization sql/set_var.cc: bye bye enum db_type sql/set_var.h: bye bye enum db_type sql/sql_base.cc: bye bye enum db_type sql/sql_cache.cc: bye bye enum db_type sql/sql_class.h: bye bye enum db_type sql/sql_delete.cc: bye bye enum db_type sql/sql_insert.cc: bye bye enum db_type sql/sql_lex.h: show plugin sql/sql_parse.cc: bye bye enum db_type sql/sql_partition.cc: bye bye enum db_type sql/sql_plugin.cc: loadable storage engines sql/sql_plugin.h: loadable storage engines sql/sql_rename.cc: bye bye enum db_type sql/sql_select.cc: bye bye enum db_type sql/sql_show.cc: SHOW PLUGIN PLUGINS information schema changes to show engines sql/sql_table.cc: bye bye enum db_type sql/sql_view.cc: bye bye enum db_type sql/sql_view.h: bye bye enum db_type sql/sql_yacc.yy: bye bye enum db_type sql/table.cc: bye bye enum db_type sql/table.h: bye bye enum db_type sql/unireg.cc: bye bye enum db_type storage/csv/ha_tina.cc: make tina into a loadable plugin storage/example/ha_example.cc: make into a plugin storage/csv/Makefile.am: New BitKeeper file ``storage/csv/Makefile.am'' storage/example/Makefile.am: New BitKeeper file ``storage/example/Makefile.am''
2005-12-21 19:18:40 +01:00
uint buflen=
my_snprintf(buf, sizeof(buf),
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
"created=%u, free=%u, sizeof=%u",
tmp.m_created, tmp.m_free, tmp.m_sizeof);
Finalize storage engine plugins Give BerkeleyDB savepoints Remove "enum db_type" from most of the code storage/example/ha_example.h: Rename: sql/examples/ha_example.h -> storage/example/ha_example.h storage/csv/ha_tina.h: Rename: sql/examples/ha_tina.h -> storage/csv/ha_tina.h config/ac-macros/storage.m4: if hton name is "no", then we don't install it as a builtin configure.in: pluggable changes include/plugin.h: version field mysql-test/r/bdb.result: savepoint results copied from innodb test mysql-test/r/information_schema.result: PLUGINS information schema mysql-test/r/information_schema_db.result: PLUGINS information schema mysql-test/t/bdb.test: savepoint test copied from innodb test sql/Makefile.am: tina and example are not here anymore sql/authors.h: minor tweek sql/ha_archive.cc: remove unwanted handlerton entries sql/ha_berkeley.cc: remove unwanted handlerton entries support for savepoints changes to show logs sql/ha_blackhole.cc: remove unwanted handlerton entries sql/ha_federated.cc: remove unwanted handlerton entries sql/ha_heap.cc: remove unwanted handlerton entries sql/ha_innodb.cc: remove unwanted handlerton entries changes for show status sql/ha_myisam.cc: remove unwanted handlerton entries sql/ha_myisammrg.cc: remove unwanted handlerton entries sql/ha_ndbcluster.cc: remove unwanted handlerton entries changes to stat_print sql/ha_partition.cc: remove unwanted handlerton entries bye bye enum db_type sql/ha_partition.h: bye bye enum db_type sql/handler.cc: remove unwanted handlerton entries bye bye enum db_type sql/handler.h: remove unwanted handlerton entries bye bye enum db_type changes to stat_print_fn sql/item_sum.cc: bye bye enum db_type sql/log.cc: remove unwanted handlerton entries sql/mysql_priv.h: bye bye enum db_type sql/mysqld.cc: bye bye enum db_type reorder plugin initialization sql/set_var.cc: bye bye enum db_type sql/set_var.h: bye bye enum db_type sql/sql_base.cc: bye bye enum db_type sql/sql_cache.cc: bye bye enum db_type sql/sql_class.h: bye bye enum db_type sql/sql_delete.cc: bye bye enum db_type sql/sql_insert.cc: bye bye enum db_type sql/sql_lex.h: show plugin sql/sql_parse.cc: bye bye enum db_type sql/sql_partition.cc: bye bye enum db_type sql/sql_plugin.cc: loadable storage engines sql/sql_plugin.h: loadable storage engines sql/sql_rename.cc: bye bye enum db_type sql/sql_select.cc: bye bye enum db_type sql/sql_show.cc: SHOW PLUGIN PLUGINS information schema changes to show engines sql/sql_table.cc: bye bye enum db_type sql/sql_view.cc: bye bye enum db_type sql/sql_view.h: bye bye enum db_type sql/sql_yacc.yy: bye bye enum db_type sql/table.cc: bye bye enum db_type sql/table.h: bye bye enum db_type sql/unireg.cc: bye bye enum db_type storage/csv/ha_tina.cc: make tina into a loadable plugin storage/example/ha_example.cc: make into a plugin storage/csv/Makefile.am: New BitKeeper file ``storage/csv/Makefile.am'' storage/example/Makefile.am: New BitKeeper file ``storage/example/Makefile.am''
2005-12-21 19:18:40 +01:00
if (stat_print(thd, ndbcluster_hton.name, strlen(ndbcluster_hton.name),
tmp.m_name, strlen(tmp.m_name), buf, buflen))
Make storage engines "pluggable", handlerton work Makefile.am: Changes to autoconf subst config/ac-macros/ha_berkeley.m4: simplify config/ac-macros/ha_ndbcluster.m4: simplify config/ac-macros/ha_partition.m4: simplify configure.in: strip configure of storage engine specific cruft and simplify extra/Makefile.am: changes to autoconf/automake subst libmysqld/Makefile.am: only compile storage engines if required. make find object file a little smarter libmysqld/examples/Makefile.am: changes to autoconf subst mysql-test/Makefile.am: remove storage engine specific cruft mysql-test/r/ps_1general.result: cannot gaurantee order of results from 'show storage engines' mysql-test/r/show_check.result: fix test - frm file fails to be deleted if it is invalid mysql-test/r/sql_mode.result: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/r/warnings.result: isam no longer exists mysql-test/t/ps_1general.test: cannot gaurantee order of results from 'show storage engines' mysql-test/t/show_check.test: fix test - frm file fails to be deleted if it is invalid mysql-test/t/sql_mode.test: isam does not exist, test may need to be redone/fixed in 5.0 mysql-test/t/system_mysql_db_fix.test: change isam to myisam mysql-test/t/view.test: change isam to myisam mysql-test/t/warnings.test: isam no longer exists sql/Makefile.am: Make storage engines "pluggable" stage 1 only compile storage engines if included sql/examples/ha_example.cc: handlerton work sql/examples/ha_example.h: handlerton work sql/examples/ha_tina.cc: handlerton work sql/examples/ha_tina.h: handlerton work sql/ha_archive.cc: handlerton work sql/ha_archive.h: handlerton work sql/ha_berkeley.cc: handlerton work sql/ha_berkeley.h: handlerton work sql/ha_blackhole.cc: handlerton work sql/ha_federated.cc: handlerton work sql/ha_federated.h: handlerton work sql/ha_heap.cc: handlerton work sql/ha_innodb.cc: handlerton work sql/ha_innodb.h: handlerton work sql/ha_myisam.cc: handlerton work sql/ha_myisammrg.cc: handlerton work sql/ha_ndbcluster.cc: handlerton work sql/ha_ndbcluster.h: handlerton work sql/ha_partition.cc: handlerton work sql/handler.cc: start removing storage engine specific cruft sql/handler.h: start removing storage engine specific cruft db_type for binlog handlerton handlerton flag for not-user-selectable storage engines sql/lex.h: start removing storage engine specific cruft sql/log.cc: handlerton work give binlog handlerton a 'real' db_type sql/mysql_priv.h: start removing storage engine specific cruft sql/mysqld.cc: start removing storage engine specific cruft sql/set_var.cc: start removing storage engine specific cruft sql/sp_head.cc: start removing storage engine specific cruft sql/sql_class.cc: start removing storage engine specific cruft sql/sql_class.h: start removing storage engine specific cruft sql/sql_lex.h: start removing storage engine specific cruft sql/sql_manager.cc: start removing storage engine specific cruft sql/sql_manager.h: start removing storage engine specific cruft sql/sql_parse.cc: start removing storage engine specific cruft sql/sql_partition.cc: start removing storage engine specific cruft sql/sql_prepare.cc: start removing storage engine specific cruft sql/sql_show.cc: start removing storage engine specific cruft sql/sql_table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE start removing storage engine specific cruft sql/sql_update.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/sql_yacc.yy: start removing storage engine specific cruft test if we should throw error sql/table.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/table.h: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE sql/unireg.cc: changed define from HAVE_PARTITION_DB to WITH_PARTITION_STORAGE_ENGINE storage/ndb/include/kernel/kernel_types.h: added my_config.h storage/ndb/include/ndb_global.h.in: added my_config.h storage/ndb/include/ndb_types.h.in: added my_config.h config/ac-macros/storage.m4: New BitKeeper file ``config/ac-macros/storage.m4'' sql/handlerton.cc.in: New BitKeeper file ``sql/handlerton.cc.in''
2005-11-07 16:25:06 +01:00
DBUG_RETURN(TRUE);
}
}
send_eof(thd);
DBUG_RETURN(FALSE);
}
2005-07-18 13:31:02 +02:00
/*
Create a table in NDB Cluster
*/
static uint get_no_fragments(ulonglong max_rows)
{
#if MYSQL_VERSION_ID >= 50000
uint acc_row_size= 25 + /*safety margin*/ 2;
#else
uint acc_row_size= pk_length*4;
/* add acc overhead */
if (pk_length <= 8) /* main page will set the limit */
acc_row_size+= 25 + /*safety margin*/ 2;
else /* overflow page will set the limit */
acc_row_size+= 4 + /*safety margin*/ 4;
#endif
ulonglong acc_fragment_size= 512*1024*1024;
#if MYSQL_VERSION_ID >= 50100
return (max_rows*acc_row_size)/acc_fragment_size+1;
#else
return ((max_rows*acc_row_size)/acc_fragment_size+1
+1/*correct rounding*/)/2;
#endif
}
/*
Routine to adjust default number of partitions to always be a multiple
of number of nodes and never more than 4 times the number of nodes.
*/
static bool adjusted_frag_count(uint no_fragments, uint no_nodes,
uint &reported_frags)
{
uint i= 0;
reported_frags= no_nodes;
while (reported_frags < no_fragments && ++i < 4 &&
(reported_frags + no_nodes) < MAX_PARTITIONS)
reported_frags+= no_nodes;
return (reported_frags < no_fragments);
}
int ha_ndbcluster::get_default_no_partitions(ulonglong max_rows)
{
uint reported_frags;
uint no_fragments= get_no_fragments(max_rows);
uint no_nodes= g_ndb_cluster_connection->no_db_nodes();
adjusted_frag_count(no_fragments, no_nodes, reported_frags);
return (int)reported_frags;
}
/*
User defined partitioning set-up. We need to check how many fragments the
user wants defined and which node groups to put those into. Later we also
want to attach those partitions to a tablespace.
All the functionality of the partition function, partition limits and so
forth are entirely handled by the MySQL Server. There is one exception to
this rule for PARTITION BY KEY where NDB handles the hash function and
this type can thus be handled transparently also by NDB API program.
For RANGE, HASH and LIST and subpartitioning the NDB API programs must
implement the function to map to a partition.
*/
uint ha_ndbcluster::set_up_partition_info(partition_info *part_info,
TABLE *table,
void *tab_par)
{
DBUG_ENTER("ha_ndbcluster::set_up_partition_info");
ushort node_group[MAX_PARTITIONS];
ulong ng_index= 0, i, j;
NDBTAB *tab= (NDBTAB*)tab_par;
NDBTAB::FragmentType ftype= NDBTAB::UserDefined;
partition_element *part_elem;
if (part_info->part_type == HASH_PARTITION &&
part_info->list_of_part_fields == TRUE)
{
Field **fields= part_info->part_field_array;
if (part_info->linear_hash_ind)
ftype= NDBTAB::DistrKeyLin;
else
ftype= NDBTAB::DistrKeyHash;
for (i= 0; i < part_info->part_field_list.elements; i++)
{
NDBCOL *col= tab->getColumn(fields[i]->fieldnr - 1);
DBUG_PRINT("info",("setting dist key on %s", col->getName()));
col->setPartitionKey(TRUE);
}
}
List_iterator<partition_element> part_it(part_info->partitions);
for (i= 0; i < part_info->no_parts; i++)
{
part_elem= part_it++;
if (!is_sub_partitioned(part_info))
{
node_group[ng_index++]= part_elem->nodegroup_id;
//Here we should insert tablespace id based on tablespace name
}
else
{
List_iterator<partition_element> sub_it(part_elem->subpartitions);
for (j= 0; j < part_info->no_subparts; j++)
{
part_elem= sub_it++;
node_group[ng_index++]= part_elem->nodegroup_id;
//Here we should insert tablespace id based on tablespace name
}
}
}
{
uint no_nodes= g_ndb_cluster_connection->no_db_nodes();
if (ng_index > 4 * no_nodes)
{
DBUG_RETURN(1300);
}
}
tab->setNodeGroupIds(&node_group, ng_index);
tab->setFragmentType(ftype);
DBUG_RETURN(0);
}
/*
This routine is used to set-up fragmentation when the user has only specified
ENGINE = NDB and no user defined partitioning what so ever. Thus all values
will be based on default values. We will choose Linear Hash or Hash with
perfect spread dependent on a session variable defined in MySQL.
*/
static void ndb_set_fragmentation(NDBTAB &tab, TABLE *form, uint pk_length)
{
NDBTAB::FragmentType ftype= NDBTAB::DistrKeyHash;
2005-07-18 13:31:02 +02:00
ushort node_group[MAX_PARTITIONS];
uint no_nodes= g_ndb_cluster_connection->no_db_nodes(), no_fragments, i;
DBUG_ENTER("ndb_set_fragmentation");
if (form->s->max_rows == (ha_rows) 0)
{
no_fragments= no_nodes;
}
else
{
/*
Ensure that we get enough fragments to handle all rows and ensure that
the table is fully distributed by keeping the number of fragments a
multiple of the number of nodes.
*/
uint fragments= get_no_fragments(form->s->max_rows);
if (adjusted_frag_count(fragments, no_nodes, no_fragments))
{
push_warning(current_thd,
MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Ndb might have problems storing the max amount of rows specified");
}
}
/*
Always start with node group 0 and continue with next node group from
there
*/
node_group[0]= 0;
for (i= 1; i < no_fragments; i++)
node_group[i]= UNDEF_NODEGROUP;
switch (opt_ndb_distribution_id)
{
case ND_KEYHASH:
2005-08-22 13:36:55 +02:00
ftype= NDBTAB::DistrKeyHash;
break;
case ND_LINHASH:
2005-07-18 13:31:02 +02:00
ftype= NDBTAB::DistrKeyLin;
break;
}
2005-07-18 13:31:02 +02:00
tab.setFragmentType(ftype);
tab.setNodeGroupIds(&node_group, no_fragments);
DBUG_VOID_RETURN;
}
Faster alter table code for 5.1. mysql-test/r/alter_table.result: Added some additional tests for new alter table code. mysql-test/t/alter_table.test: Added some additional tests for new alter table code. sql/field.cc: Functions to check whether new field is equal with old field. Classes for different types. sql/field.h: Functions to check whether new field is equal with old field. Classes for different types. sql/ha_berkeley.cc: check_if_incompatible_data() for BDB. sql/ha_berkeley.h: check_if_incompatible_data() for BDB. sql/ha_heap.cc: check_if_incompatible_data() for HEAP. sql/ha_heap.h: check_if_incompatible_data() for HEAP. sql/ha_innodb.cc: check_if_incompatible_data() for InnoDB. sql/ha_innodb.h: check_if_incompatible_data() for InnoBD. sql/ha_myisam.cc: check_if_incompatible_data() for MyISAM. sql/ha_myisam.h: check_if_incompatible_data() for MyISAM. sql/ha_myisammrg.cc: check_if_incompatible_data() for Merge tables. sql/ha_myisammrg.h: check_if_incompatible_data() for Merge tables. sql/ha_ndbcluster.cc: check_if_incompatible_data() for NDB. sql/ha_ndbcluster.h: check_if_incompatible_data() for NDB. sql/handler.h: Defines for COMPATIBLE_DATA (yes and no) and the default function for check_if_incompatible_data(). sql/mysql_priv.h: Defines for IS_EQUAL_* sql/mysqld.cc: Added option --old-alter-table to disable new alter table code. sql/set_var.cc: Added option --old-alter-table to disable new alter table code. sql/set_var.h: Added option --old-alter-table to disable new alter table code. sql/sql_class.h: Added option --old-alter-table to disable new alter table code. sql/sql_lex.h: Added a flag for forcing recreation of a table (needed for optimize table mapped to alter table) sql/sql_table.cc: Made a function of setting table default charset, used now in two places. Added defines for ALTER_TABLE_* possible changes. Currently just overall data and index. Added function compare_tables, which checks fields compatibility in old and new tables. BitKeeper/etc/config: Disabled logging
2005-07-22 22:43:59 +02:00
bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes)
{
2005-07-23 10:50:31 +02:00
/*
TODO: Remove the dummy return below, when cluster gets
signal from alter table when only .frm is changed. Cluster
needs it to manage the copies.
*/
Faster alter table code for 5.1. mysql-test/r/alter_table.result: Added some additional tests for new alter table code. mysql-test/t/alter_table.test: Added some additional tests for new alter table code. sql/field.cc: Functions to check whether new field is equal with old field. Classes for different types. sql/field.h: Functions to check whether new field is equal with old field. Classes for different types. sql/ha_berkeley.cc: check_if_incompatible_data() for BDB. sql/ha_berkeley.h: check_if_incompatible_data() for BDB. sql/ha_heap.cc: check_if_incompatible_data() for HEAP. sql/ha_heap.h: check_if_incompatible_data() for HEAP. sql/ha_innodb.cc: check_if_incompatible_data() for InnoDB. sql/ha_innodb.h: check_if_incompatible_data() for InnoBD. sql/ha_myisam.cc: check_if_incompatible_data() for MyISAM. sql/ha_myisam.h: check_if_incompatible_data() for MyISAM. sql/ha_myisammrg.cc: check_if_incompatible_data() for Merge tables. sql/ha_myisammrg.h: check_if_incompatible_data() for Merge tables. sql/ha_ndbcluster.cc: check_if_incompatible_data() for NDB. sql/ha_ndbcluster.h: check_if_incompatible_data() for NDB. sql/handler.h: Defines for COMPATIBLE_DATA (yes and no) and the default function for check_if_incompatible_data(). sql/mysql_priv.h: Defines for IS_EQUAL_* sql/mysqld.cc: Added option --old-alter-table to disable new alter table code. sql/set_var.cc: Added option --old-alter-table to disable new alter table code. sql/set_var.h: Added option --old-alter-table to disable new alter table code. sql/sql_class.h: Added option --old-alter-table to disable new alter table code. sql/sql_lex.h: Added a flag for forcing recreation of a table (needed for optimize table mapped to alter table) sql/sql_table.cc: Made a function of setting table default charset, used now in two places. Added defines for ALTER_TABLE_* possible changes. Currently just overall data and index. Added function compare_tables, which checks fields compatibility in old and new tables. BitKeeper/etc/config: Disabled logging
2005-07-22 22:43:59 +02:00
return COMPATIBLE_DATA_NO;
if (table_changes != IS_EQUAL_YES)
return COMPATIBLE_DATA_NO;
/* Check that auto_increment value was not changed */
if ((info->used_fields & HA_CREATE_USED_AUTO) &&
info->auto_increment_value != 0)
return COMPATIBLE_DATA_NO;
/* Check that row format didn't change */
if ((info->used_fields & HA_CREATE_USED_AUTO) &&
get_row_type() != info->row_type)
return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES;
}
Import ndb varsize BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
2005-11-07 12:19:28 +01:00
#ifdef NDB_DISKDATA
bool set_up_tablespace(st_alter_tablespace *info,
NdbDictionary::Tablespace *ndb_ts)
{
ndb_ts->setName(info->tablespace_name);
ndb_ts->setExtentSize(info->extent_size);
ndb_ts->setDefaultLogfileGroup(info->logfile_group_name);
return false;
}
bool set_up_datafile(st_alter_tablespace *info,
NdbDictionary::Datafile *ndb_df)
{
if (info->max_size > 0)
{
my_error(ER_TABLESPACE_AUTO_EXTEND_ERROR, MYF(0));
return true;
}
ndb_df->setPath(info->data_file_name);
ndb_df->setSize(info->initial_size);
ndb_df->setTablespace(info->tablespace_name);
return false;
}
bool set_up_logfile_group(st_alter_tablespace *info,
NdbDictionary::LogfileGroup *ndb_lg)
{
ndb_lg->setName(info->logfile_group_name);
ndb_lg->setUndoBufferSize(info->undo_buffer_size);
return false;
}
bool set_up_undofile(st_alter_tablespace *info,
NdbDictionary::Undofile *ndb_uf)
{
ndb_uf->setPath(info->undo_file_name);
ndb_uf->setSize(info->initial_size);
ndb_uf->setLogfileGroup(info->logfile_group_name);
return false;
}
int ha_ndbcluster::alter_tablespace(st_alter_tablespace *info)
{
Ndb *ndb;
NDBDICT *dict;
int error;
DBUG_ENTER("ha_ndbcluster::alter_tablespace");
if (check_ndb_connection())
{
DBUG_RETURN(my_errno= HA_ERR_NO_CONNECTION);
}
ndb= get_ndb();
dict= ndb->getDictionary();
switch (info->ts_cmd_type){
case (CREATE_TABLESPACE):
{
NdbDictionary::Tablespace ndb_ts;
NdbDictionary::Datafile ndb_df;
if (set_up_tablespace(info, &ndb_ts))
{
DBUG_RETURN(1);
}
if (set_up_datafile(info, &ndb_df))
{
DBUG_RETURN(1);
}
if (error= dict->createTablespace(ndb_ts))
{
DBUG_PRINT("error", ("createTablespace returned %d", error));
my_error(ER_CREATE_TABLESPACE_FAILED, MYF(0), "TABLESPACE");
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("Successfully created Tablespace"));
if (error= dict->createDatafile(ndb_df))
{
DBUG_PRINT("error", ("createDatafile returned %d", error));
my_error(ER_CREATE_TABLESPACE_FAILED, MYF(0), "DATAFILE");
DBUG_RETURN(1);
}
break;
}
case (ALTER_TABLESPACE):
{
if (info->ts_alter_tablespace_type == ALTER_TABLESPACE_ADD_FILE)
{
NdbDictionary::Datafile ndb_df;
if (set_up_datafile(info, &ndb_df))
{
DBUG_RETURN(1);
}
if (error= dict->createDatafile(ndb_df))
{
DBUG_PRINT("error", ("createDatafile returned %d", error));
my_error(ER_ALTER_TABLESPACE_FAILED, MYF(0), "CREATE DATAFILE");
DBUG_RETURN(1);
}
}
else if(info->ts_alter_tablespace_type == ALTER_TABLESPACE_DROP_FILE)
{
NdbDictionary::Datafile df = dict->getDatafile(0,
info->data_file_name);
if (strcmp(df.getPath(), info->data_file_name) == 0)
{
if (error= dict->dropDatafile(df))
{
DBUG_PRINT("error", ("createDatafile returned %d", error));
my_error(ER_ALTER_TABLESPACE_FAILED, MYF(0), " DROP DATAFILE");
DBUG_RETURN(1);
}
}
else
{
DBUG_PRINT("error", ("No such datafile"));
my_error(ER_ALTER_TABLESPACE_FAILED, MYF(0), " NO SUCH FILE");
DBUG_RETURN(1);
}
}
else
{
DBUG_PRINT("error", ("Unsupported alter tablespace: %d",
info->ts_alter_tablespace_type));
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
}
break;
}
case (CREATE_LOGFILE_GROUP):
{
NdbDictionary::LogfileGroup ndb_lg;
NdbDictionary::Undofile ndb_uf;
if (info->undo_file_name == NULL)
{
/*
REDO files in LOGFILE GROUP not supported yet
*/
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
}
if (set_up_logfile_group(info, &ndb_lg))
{
DBUG_RETURN(1);
}
if (error= dict->createLogfileGroup(ndb_lg))
{
DBUG_PRINT("error", ("createLogfileGroup returned %d", error));
my_error(ER_CREATE_TABLESPACE_FAILED, MYF(0), "LOGFILE GROUP");
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("Successfully created Logfile Group"));
if (set_up_undofile(info, &ndb_uf))
{
DBUG_RETURN(1);
}
if (error= dict->createUndofile(ndb_uf))
{
DBUG_PRINT("error", ("createUndofile returned %d", error));
my_error(ER_CREATE_TABLESPACE_FAILED, MYF(0), "UNDOFILE");
DBUG_RETURN(1);
}
break;
}
case (ALTER_LOGFILE_GROUP):
{
if (info->undo_file_name == NULL)
{
/*
REDO files in LOGFILE GROUP not supported yet
*/
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
}
NdbDictionary::Undofile ndb_uf;
if (set_up_undofile(info, &ndb_uf))
{
DBUG_RETURN(1);
}
if (error= dict->createUndofile(ndb_uf))
{
DBUG_PRINT("error", ("createUndofile returned %d", error));
my_error(ER_ALTER_TABLESPACE_FAILED, MYF(0), "CREATE UNDOFILE");
DBUG_RETURN(1);
}
break;
}
case (DROP_TABLESPACE):
{
if (error= dict->dropTablespace(
dict->getTablespace(info->tablespace_name)))
{
DBUG_PRINT("error", ("dropTablespace returned %d", error));
my_error(ER_DROP_TABLESPACE_FAILED, MYF(0), "TABLESPACE");
DBUG_RETURN(1);
}
break;
}
case (DROP_LOGFILE_GROUP):
{
if (error= dict->dropLogfileGroup(dict->getLogfileGroup(info->logfile_group_name)))
{
DBUG_PRINT("error", ("dropLogfileGroup returned %d", error));
my_error(ER_DROP_TABLESPACE_FAILED, MYF(0), "LOGFILE GROUP");
DBUG_RETURN(1);
}
break;
}
case (CHANGE_FILE_TABLESPACE):
{
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
}
case (ALTER_ACCESS_MODE_TABLESPACE):
{
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
}
default:
{
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
}
}
DBUG_RETURN(FALSE);
}
#endif /* NDB_DISKDATA */