mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
f3e4ce926d
into mysql.com:/home/kent/bk/main/mysql-5.1 BUILD/Makefile.am: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~10: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~11: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~12: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~13: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~14: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~15: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~1: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~2f6eabb2f69cb33d: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~2: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~3: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~4ef559bc8b4695f7: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~4: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~5: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~6: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~7: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~84669765249a4bad: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~8: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~9: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~c20dcd005f596740: Auto merged BitKeeper/deleted/.del-CMakeLists.txt~dd682cce1d53c0b4: Auto merged BitKeeper/deleted/.del-Makefile.am~2: Auto merged BitKeeper/deleted/.del-Makefile.am~ab5c84d46412dc2e: Auto merged BitKeeper/deleted/.del-Makefile.am~de166d6fcac3b9b6: Auto merged BitKeeper/deleted/.del-Makefile.am~e5b911533dad2713: Auto merged BitKeeper/deleted/.del-Makefile.am~ead19441cc5ff35c: Auto merged BitKeeper/deleted/.del-Makefile.am~f87185e232d7c4f: Auto merged BitKeeper/deleted/.del-Makefile.in: Auto merged BitKeeper/deleted/.del-ReadMe.txt~573b1e4ebab241e1: Auto merged BitKeeper/deleted/.del-build-vs71.bat: Auto merged BitKeeper/deleted/.del-build-vs8.bat: Auto merged BitKeeper/deleted/.del-configure.js: Auto merged BitKeeper/deleted/.del-copy_mysql_files.bat~f6878eeb80173de9: Auto merged BitKeeper/deleted/.del-ha_berkeley.cc: Auto merged BitKeeper/deleted/.del-ha_berkeley.h: Auto merged BitKeeper/deleted/.del-make_win_bin_dist: Auto merged BitKeeper/deleted/.del-make_win_src_distribution.sh~f80d8fca44e4e5f1: Auto merged BitKeeper/deleted/.del-my_create_tables.c~c121a0c4c427ebb: Auto merged BitKeeper/deleted/.del-mysql_explain_log.sh~5ddc62808e16bd57: Auto merged BitKeeper/deleted/.del-mysql_thr.c~20772782813d1274: Auto merged BitKeeper/deleted/.del-mysql_upgrade.sh~826da969ccf96ef: Auto merged BitKeeper/deleted/.del-mysqlmanager.c~e97636d71145a0b: Auto merged BitKeeper/deleted/.del-prepare~773a10a535120a7e: Auto merged BitKeeper/deleted/.del-print-limit-table~b8e808031daa3758: Auto merged BitKeeper/deleted/.del-sql_manager.h: Auto merged BitKeeper/deleted/.del-thr_test.c~70fc0971c72f2a95: Auto merged Docs/Makefile.am: Auto merged Docs/generate-text-files.pl: Auto merged client/Makefile.am: Auto merged client/client_priv.h: Auto merged client/mysqladmin.cc: Auto merged client/mysqlimport.c: Auto merged client/mysqlshow.c: Auto merged dbug/Makefile.am: Auto merged extra/Makefile.am: Auto merged extra/yassl/taocrypt/benchmark/Makefile.am: Auto merged extra/yassl/taocrypt/test/Makefile.am: Auto merged include/Makefile.am: Auto merged include/my_time.h: Auto merged libmysql/Makefile.am: Auto merged libmysql_r/Makefile.am: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/embedded_priv.h: Auto merged mysql-test/Makefile.am: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/lib/mtr_cases.pl: Auto merged mysql-test/lib/mtr_io.pl: Auto merged mysql-test/lib/mtr_match.pl: Auto merged mysql-test/lib/mtr_misc.pl: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/lib/mtr_report.pl: Auto merged mysql-test/lib/mtr_timer.pl: Auto merged mysql-test/ndb/ndbcluster.sh: Auto merged mysys/Makefile.am: Auto merged mysys/my_gethostbyname.c: Auto merged mysys/my_getopt.c: Auto merged mysys/my_handler.c: Auto merged regex/Makefile.am: Auto merged scripts/Makefile.am: Auto merged scripts/fill_func_tables.sh: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_convert_table_format.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sh: Auto merged scripts/mysql_install_db.sh: Auto merged server-tools/instance-manager/IMService.cpp: Auto merged server-tools/instance-manager/WindowsService.cpp: Auto merged server-tools/instance-manager/listener.cc: Auto merged server-tools/instance-manager/log.cc: Auto merged server-tools/instance-manager/log.h: Auto merged server-tools/instance-manager/manager.cc: Auto merged server-tools/instance-manager/messages.cc: Auto merged server-tools/instance-manager/mysql_connection.cc: Auto merged server-tools/instance-manager/mysqlmanager.cc: Auto merged server-tools/instance-manager/options.cc: Auto merged server-tools/instance-manager/options.h: Auto merged server-tools/instance-manager/portability.h: Auto merged server-tools/instance-manager/priv.cc: Auto merged server-tools/instance-manager/protocol.cc: Auto merged server-tools/instance-manager/protocol.h: Auto merged server-tools/instance-manager/thread_registry.cc: Auto merged server-tools/instance-manager/thread_registry.h: Auto merged server-tools/instance-manager/user_map.cc: Auto merged server-tools/instance-manager/user_map.h: Auto merged sql/Makefile.am: Auto merged sql/discover.cc: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/filesort.cc: Auto merged sql/gen_lex_hash.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/hostname.cc: Auto merged sql/init.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.h: Auto merged sql/item_geofunc.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.h: Auto merged sql/item_uniq.cc: Auto merged sql/key.cc: Auto merged sql/lex_symbol.h: Auto merged sql/lock.cc: Auto merged sql/log_event.h: Auto merged sql/my_decimal.cc: Auto merged sql/my_decimal.h: Auto merged sql/my_lock.c: Auto merged sql/opt_range.cc: Auto merged sql/opt_range.h: Auto merged sql/password.c: Auto merged sql/procedure.h: Auto merged sql/protocol.h: Auto merged sql/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.h: Auto merged sql/spatial.h: Auto merged sql/sql_acl.h: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_analyse.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_crypt.cc: Auto merged sql/sql_cursor.cc: Auto merged sql/sql_do.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_manager.cc: Auto merged sql/sql_map.cc: Auto merged sql/sql_olap.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_repl.h: Auto merged sql-bench/Makefile.am: Auto merged sql-bench/as3ap.sh: Auto merged sql-bench/bench-count-distinct.sh: Auto merged sql-bench/bench-init.pl.sh: Auto merged sql-bench/compare-results.sh: Auto merged sql-bench/copy-db.sh: Auto merged sql-bench/crash-me.sh: Auto merged sql-bench/run-all-tests.sh: Auto merged sql-bench/server-cfg.sh: Auto merged sql-bench/test-ATIS.sh: Auto merged sql-bench/test-alter-table.sh: Auto merged sql-bench/test-big-tables.sh: Auto merged sql-bench/test-connect.sh: Auto merged sql-bench/test-create.sh: Auto merged sql-bench/test-insert.sh: Auto merged sql-bench/test-select.sh: Auto merged sql-bench/test-transactions.sh: Auto merged sql-bench/test-wisconsin.sh: Auto merged sql-common/my_time.c: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_test.cc: Auto merged sql/sql_update.cc: Auto merged sql/structs.h: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/time.cc: Auto merged sql/unireg.cc: Auto merged sql/unireg.h: Auto merged storage/federated/ha_federated.cc: Auto merged storage/heap/Makefile.am: Auto merged storage/heap/_check.c: Auto merged storage/heap/_rectest.c: Auto merged storage/heap/ha_heap.cc: Auto merged storage/heap/ha_heap.h: Auto merged storage/heap/heapdef.h: Auto merged storage/heap/hp_block.c: Auto merged storage/heap/hp_clear.c: Auto merged storage/heap/hp_close.c: Auto merged storage/heap/hp_create.c: Auto merged storage/heap/hp_delete.c: Auto merged storage/heap/hp_extra.c: Auto merged storage/heap/hp_hash.c: Auto merged storage/heap/hp_info.c: Auto merged storage/heap/hp_open.c: Auto merged storage/heap/hp_panic.c: Auto merged storage/heap/hp_rename.c: Auto merged storage/heap/hp_rfirst.c: Auto merged storage/heap/hp_rkey.c: Auto merged storage/heap/hp_rlast.c: Auto merged storage/heap/hp_rnext.c: Auto merged storage/heap/hp_rprev.c: Auto merged storage/heap/hp_rrnd.c: Auto merged storage/heap/hp_rsame.c: Auto merged storage/heap/hp_scan.c: Auto merged storage/heap/hp_static.c: Auto merged storage/heap/hp_test1.c: Auto merged storage/heap/hp_test2.c: Auto merged storage/heap/hp_update.c: Auto merged storage/heap/hp_write.c: Auto merged storage/innobase/Makefile.am: Auto merged storage/innobase/btr/Makefile.am: Auto merged storage/innobase/buf/Makefile.am: Auto merged storage/innobase/data/Makefile.am: Auto merged storage/innobase/dict/Makefile.am: Auto merged storage/innobase/dyn/Makefile.am: Auto merged storage/innobase/eval/Makefile.am: Auto merged storage/innobase/fil/Makefile.am: Auto merged storage/innobase/fsp/Makefile.am: Auto merged storage/innobase/fut/Makefile.am: Auto merged storage/innobase/ha/Makefile.am: Auto merged storage/innobase/ibuf/Makefile.am: Auto merged storage/innobase/lock/Makefile.am: Auto merged storage/innobase/log/Makefile.am: Auto merged storage/innobase/mach/Makefile.am: Auto merged storage/innobase/mem/Makefile.am: Auto merged storage/innobase/mtr/Makefile.am: Auto merged storage/innobase/os/Makefile.am: Auto merged storage/innobase/page/Makefile.am: Auto merged storage/innobase/pars/Makefile.am: Auto merged storage/innobase/que/Makefile.am: Auto merged storage/innobase/read/Makefile.am: Auto merged storage/innobase/rem/Makefile.am: Auto merged storage/innobase/row/Makefile.am: Auto merged storage/innobase/srv/Makefile.am: Auto merged storage/innobase/sync/Makefile.am: Auto merged storage/innobase/thr/Makefile.am: Auto merged storage/innobase/trx/Makefile.am: Auto merged storage/innobase/usr/Makefile.am: Auto merged storage/innobase/ut/Makefile.am: Auto merged storage/myisam/Makefile.am: Auto merged storage/myisam/ft_boolean_search.c: Auto merged storage/myisam/ft_eval.c: Auto merged storage/myisam/ft_nlq_search.c: Auto merged storage/myisam/ft_parser.c: Auto merged storage/myisam/ft_static.c: Auto merged storage/myisam/ft_stem.c: Auto merged storage/myisam/ft_stopwords.c: Auto merged storage/myisam/ft_test1.c: Auto merged storage/myisam/ft_test1.h: Auto merged storage/myisam/ft_update.c: Auto merged storage/myisam/ftdefs.h: Auto merged storage/myisam/fulltext.h: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/ha_myisam.h: Auto merged storage/myisam/mi_cache.c: Auto merged storage/myisam/mi_changed.c: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_checksum.c: Auto merged storage/myisam/mi_close.c: Auto merged storage/myisam/mi_create.c: Auto merged storage/myisam/mi_dbug.c: Auto merged storage/myisam/mi_delete.c: Auto merged storage/myisam/mi_delete_all.c: Auto merged storage/myisam/mi_delete_table.c: Auto merged storage/myisam/mi_dynrec.c: Auto merged storage/myisam/mi_extra.c: Auto merged storage/myisam/mi_info.c: Auto merged storage/myisam/mi_key.c: Auto merged storage/myisam/mi_locking.c: Auto merged storage/myisam/mi_log.c: Auto merged storage/myisam/mi_open.c: Auto merged storage/myisam/mi_packrec.c: Auto merged storage/myisam/mi_page.c: Auto merged storage/myisam/mi_panic.c: Auto merged storage/myisam/mi_preload.c: Auto merged storage/myisam/mi_range.c: Auto merged storage/myisam/mi_rename.c: Auto merged storage/myisam/mi_rfirst.c: Auto merged storage/myisam/mi_rkey.c: Auto merged storage/myisam/mi_rlast.c: Auto merged storage/myisam/mi_rnext.c: Auto merged storage/myisam/mi_rnext_same.c: Auto merged storage/myisam/mi_rprev.c: Auto merged storage/myisam/mi_rrnd.c: Auto merged storage/myisam/mi_rsame.c: Auto merged storage/myisam/mi_rsamepos.c: Auto merged storage/myisam/mi_scan.c: Auto merged storage/myisam/mi_search.c: Auto merged storage/myisam/mi_static.c: Auto merged storage/myisam/mi_statrec.c: Auto merged storage/myisam/mi_test1.c: Auto merged storage/myisam/mi_test2.c: Auto merged storage/myisam/mi_test3.c: Auto merged storage/myisam/mi_unique.c: Auto merged storage/myisam/mi_update.c: Auto merged storage/myisam/mi_write.c: Auto merged storage/myisam/myisam_ftdump.c: Auto merged storage/myisam/myisamdef.h: Auto merged storage/myisam/myisamlog.c: Auto merged storage/myisam/myisampack.c: Auto merged storage/myisam/rt_index.c: Auto merged storage/myisam/rt_index.h: Auto merged storage/myisam/rt_key.h: Auto merged storage/myisam/rt_mbr.c: Auto merged storage/myisam/rt_mbr.h: Auto merged storage/myisam/rt_split.c: Auto merged storage/myisam/rt_test.c: Auto merged storage/myisam/sort.c: Auto merged storage/myisam/sp_defs.h: Auto merged storage/myisam/sp_test.c: Auto merged storage/myisammrg/Makefile.am: Auto merged storage/myisammrg/ha_myisammrg.cc: Auto merged storage/myisammrg/ha_myisammrg.h: Auto merged storage/myisammrg/myrg_close.c: Auto merged storage/myisammrg/myrg_create.c: Auto merged storage/myisammrg/myrg_def.h: Auto merged storage/myisammrg/myrg_delete.c: Auto merged storage/myisammrg/myrg_extra.c: Auto merged storage/myisammrg/myrg_info.c: Auto merged storage/myisammrg/myrg_locking.c: Auto merged storage/myisammrg/myrg_open.c: Auto merged storage/myisammrg/myrg_panic.c: Auto merged storage/myisammrg/myrg_queue.c: Auto merged storage/myisammrg/myrg_range.c: Auto merged storage/myisammrg/myrg_rfirst.c: Auto merged storage/myisammrg/myrg_rkey.c: Auto merged storage/myisammrg/myrg_rlast.c: Auto merged storage/myisammrg/myrg_rnext.c: Auto merged storage/myisammrg/myrg_rnext_same.c: Auto merged storage/myisammrg/myrg_rprev.c: Auto merged storage/myisammrg/myrg_rrnd.c: Auto merged storage/myisammrg/myrg_rsame.c: Auto merged storage/myisammrg/myrg_static.c: Auto merged storage/myisammrg/myrg_update.c: Auto merged storage/myisammrg/myrg_write.c: Auto merged storage/ndb/Makefile.am: Auto merged storage/ndb/config/common.mk.am: Auto merged storage/ndb/config/type_kernel.mk.am: Auto merged storage/ndb/config/type_mgmapiclient.mk.am: Auto merged storage/ndb/config/type_ndbapi.mk.am: Auto merged storage/ndb/config/type_ndbapiclient.mk.am: Auto merged storage/ndb/config/type_ndbapitest.mk.am: Auto merged storage/ndb/config/type_ndbapitools.mk.am: Auto merged storage/ndb/config/type_util.mk.am: Auto merged storage/ndb/docs/Makefile.am: Auto merged storage/ndb/include/Makefile.am: Auto merged storage/ndb/include/kernel/kernel_config_parameters.h: Auto merged storage/ndb/include/kernel/signaldata/CntrStart.hpp: Auto merged storage/ndb/include/kernel/signaldata/ReadConfig.hpp: Auto merged storage/ndb/include/kernel/signaldata/UpgradeStartup.hpp: Auto merged storage/ndb/include/logger/FileLogHandler.hpp: Auto merged storage/ndb/include/ndb_net.h: Auto merged storage/ndb/include/mgmapi/mgmapi_config_parameters.h: Auto merged storage/ndb/include/mgmapi/mgmapi_config_parameters_debug.h: Auto merged storage/ndb/include/util/ConfigValues.hpp: Auto merged storage/ndb/include/util/File.hpp: Auto merged storage/ndb/include/util/Vector.hpp: Auto merged storage/ndb/src/Makefile.am: Auto merged storage/ndb/src/common/Makefile.am: Auto merged storage/ndb/src/common/debugger/Makefile.am: Auto merged storage/ndb/src/common/debugger/signaldata/CntrStart.cpp: Auto merged storage/ndb/src/common/debugger/signaldata/Makefile.am: Auto merged storage/ndb/src/common/debugger/signaldata/ReadNodesConf.cpp: Auto merged storage/ndb/src/common/debugger/signaldata/print.awk: Auto merged storage/ndb/src/common/logger/FileLogHandler.cpp: Auto merged storage/ndb/src/common/logger/Makefile.am: Auto merged storage/ndb/src/common/mgmcommon/Makefile.am: Auto merged storage/ndb/src/common/transporter/Makefile.am: Auto merged storage/ndb/src/common/util/Bitmask.cpp: Auto merged storage/ndb/src/common/util/ConfigValues.cpp: Auto merged storage/ndb/src/common/util/File.cpp: Auto merged storage/ndb/src/common/util/Makefile.am: Auto merged storage/ndb/src/common/util/new.cpp: Auto merged storage/ndb/src/common/util/testConfigValues/testConfigValues.cpp: Auto merged storage/ndb/src/cw/Makefile.am: Auto merged storage/ndb/src/cw/cpcd/Makefile.am: Auto merged storage/ndb/src/kernel/blocks/Makefile.am: Auto merged storage/ndb/src/kernel/blocks/backup/Makefile.am: Auto merged storage/ndb/src/kernel/blocks/dbdict/Master_AddTable.sfl: Auto merged storage/ndb/src/kernel/blocks/dbdict/Slave_AddTable.sfl: Auto merged storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Auto merged storage/ndb/src/kernel/error/Makefile.am: Auto merged storage/ndb/src/kernel/vm/Makefile.am: Auto merged storage/ndb/src/mgmapi/Makefile.am: Auto merged storage/ndb/src/mgmapi/mgmapi_configuration.cpp: Auto merged storage/ndb/src/mgmclient/Makefile.am: Auto merged storage/ndb/src/mgmsrv/Makefile.am: Auto merged storage/ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged storage/ndb/src/ndbapi/Makefile.am: Auto merged storage/ndb/src/ndbapi/NdbTransaction.cpp: Auto merged storage/ndb/src/ndbapi/Ndbif.cpp: Auto merged storage/ndb/test/Makefile.am: Auto merged storage/ndb/test/ndbapi/Makefile.am: Auto merged storage/ndb/test/ndbapi/bank/Makefile.am: Auto merged storage/ndb/test/ndbapi/testBasic.cpp: Auto merged storage/ndb/test/ndbapi/testIndex.cpp: Auto merged storage/ndb/test/run-test/Makefile.am: Auto merged storage/ndb/test/run-test/daily-basic-tests.txt: Auto merged storage/ndb/test/src/Makefile.am: Auto merged storage/ndb/test/tools/Makefile.am: Auto merged storage/ndb/tools/Makefile.am: Auto merged strings/Makefile.am: Auto merged strings/ctype-extra.c: Auto merged tests/Makefile.am: Auto merged vio/Makefile.am: Auto merged BitKeeper/deleted/.del-colspec-fix.pl~6c78d3332330b19e: Auto merged BitKeeper/deleted/.del-docbook-fixup.pl~46cf3bdef147084e: Auto merged BitKeeper/deleted/.del-docbook-prefix.pl~876c7d33c68c224a: Auto merged BitKeeper/deleted/.del-docbook-split~be931c3922898d0: Auto merged BitKeeper/deleted/.del-make-docbook~ccac1eb717e92ac9: Auto merged BitKeeper/deleted/.del-make-makefile~39fd454b487126e8: Auto merged BitKeeper/deleted/.del-test-make-manual-de~33cad2886311b8a: Auto merged BitKeeper/deleted/.del-test-make-manual~5da458f958a424ec: Auto merged BitKeeper/deleted/.del-xwf~76b97805d9146b80: Auto merged server-tools/instance-manager/listener.h: SCCS merged server-tools/instance-manager/manager.h: SCCS merged server-tools/instance-manager/mysql_connection.h: SCCS merged server-tools/instance-manager/priv.h: SCCS merged storage/ndb/src/kernel/blocks/dblqh/Makefile.am: SCCS merged
1041 lines
28 KiB
C++
1041 lines
28 KiB
C++
/* Copyright (C) 2000-2006 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
/* Function items used by mysql */
|
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
|
#pragma interface /* gcc class implementation */
|
|
#endif
|
|
|
|
enum date_time_format_types
|
|
{
|
|
TIME_ONLY= 0, TIME_MICROSECOND, DATE_ONLY, DATE_TIME, DATE_TIME_MICROSECOND
|
|
};
|
|
|
|
bool get_interval_value(Item *args,interval_type int_type,
|
|
String *str_value, INTERVAL *interval);
|
|
|
|
class Item_func_period_add :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_period_add(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "period_add"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_period_diff :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_period_diff(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "period_diff"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_to_days :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_to_days(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "to_days"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
enum_monotonicity_info get_monotonicity_info() const;
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_dayofmonth :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_dayofmonth(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "dayofmonth"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_month :public Item_func
|
|
{
|
|
public:
|
|
Item_func_month(Item *a) :Item_func(a) {}
|
|
longlong val_int();
|
|
double val_real()
|
|
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
|
|
String *val_str(String *str)
|
|
{
|
|
str->set(val_int(), &my_charset_bin);
|
|
return null_value ? 0 : str;
|
|
}
|
|
const char *func_name() const { return "month"; }
|
|
enum Item_result result_type () const { return INT_RESULT; }
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
decimals=0;
|
|
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_monthname :public Item_func_month
|
|
{
|
|
public:
|
|
Item_func_monthname(Item *a) :Item_func_month(a) {}
|
|
const char *func_name() const { return "monthname"; }
|
|
String *val_str(String *str);
|
|
enum Item_result result_type () const { return STRING_RESULT; }
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
decimals=0;
|
|
max_length=10*my_charset_bin.mbmaxlen;
|
|
maybe_null=1;
|
|
}
|
|
};
|
|
|
|
|
|
class Item_func_dayofyear :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_dayofyear(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "dayofyear"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=3*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_hour :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_hour(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "hour"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_minute :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_minute(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "minute"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_quarter :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_quarter(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "quarter"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_second :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_second(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "second"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_week :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_week(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "week"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
class Item_func_yearweek :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_yearweek(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "yearweek"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_year :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_year(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "year"; }
|
|
enum_monotonicity_info get_monotonicity_info() const;
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=4*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_weekday :public Item_func
|
|
{
|
|
bool odbc_type;
|
|
public:
|
|
Item_func_weekday(Item *a,bool type_arg)
|
|
:Item_func(a), odbc_type(type_arg) {}
|
|
longlong val_int();
|
|
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
|
String *val_str(String *str)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
str->set(val_int(), &my_charset_bin);
|
|
return null_value ? 0 : str;
|
|
}
|
|
const char *func_name() const
|
|
{
|
|
return (odbc_type ? "dayofweek" : "weekday");
|
|
}
|
|
enum Item_result result_type () const { return INT_RESULT; }
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
decimals=0;
|
|
max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
class Item_func_dayname :public Item_func_weekday
|
|
{
|
|
public:
|
|
Item_func_dayname(Item *a) :Item_func_weekday(a,0) {}
|
|
const char *func_name() const { return "dayname"; }
|
|
String *val_str(String *str);
|
|
enum Item_result result_type () const { return STRING_RESULT; }
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
decimals=0;
|
|
max_length=9*MY_CHARSET_BIN_MB_MAXLEN;
|
|
maybe_null=1;
|
|
}
|
|
};
|
|
|
|
|
|
class Item_func_unix_timestamp :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_unix_timestamp() :Item_int_func() {}
|
|
Item_func_unix_timestamp(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "unix_timestamp"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_time_to_sec :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_time_to_sec(Item *item) :Item_int_func(item) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "time_to_sec"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
/*
|
|
This can't be a Item_str_func, because the val_real() functions are special
|
|
*/
|
|
|
|
class Item_date :public Item_func
|
|
{
|
|
public:
|
|
Item_date() :Item_func() {}
|
|
Item_date(Item *a) :Item_func(a) {}
|
|
enum Item_result result_type () const { return STRING_RESULT; }
|
|
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
|
String *val_str(String *str);
|
|
longlong val_int();
|
|
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
|
const char *func_name() const { return "date"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
decimals=0;
|
|
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 0);
|
|
}
|
|
bool result_as_longlong() { return TRUE; }
|
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return val_decimal_from_date(decimal_value);
|
|
}
|
|
int save_in_field(Field *field, bool no_conversions)
|
|
{
|
|
return save_date_in_field(field);
|
|
}
|
|
};
|
|
|
|
|
|
class Item_date_func :public Item_str_func
|
|
{
|
|
public:
|
|
Item_date_func() :Item_str_func() {}
|
|
Item_date_func(Item *a) :Item_str_func(a) {}
|
|
Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {}
|
|
Item_date_func(Item *a,Item *b, Item *c) :Item_str_func(a,b,c) {}
|
|
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 0);
|
|
}
|
|
bool result_as_longlong() { return TRUE; }
|
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return val_decimal_from_date(decimal_value);
|
|
}
|
|
int save_in_field(Field *field, bool no_conversions)
|
|
{
|
|
return save_date_in_field(field);
|
|
}
|
|
};
|
|
|
|
|
|
class Item_str_timefunc :public Item_str_func
|
|
{
|
|
public:
|
|
Item_str_timefunc() :Item_str_func() {}
|
|
Item_str_timefunc(Item *a) :Item_str_func(a) {}
|
|
Item_str_timefunc(Item *a,Item *b) :Item_str_func(a,b) {}
|
|
Item_str_timefunc(Item *a, Item *b, Item *c) :Item_str_func(a, b ,c) {}
|
|
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 0);
|
|
}
|
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return val_decimal_from_time(decimal_value);
|
|
}
|
|
int save_in_field(Field *field, bool no_conversions)
|
|
{
|
|
return save_time_in_field(field);
|
|
}
|
|
};
|
|
|
|
|
|
/* Abstract CURTIME function. Children should define what time zone is used */
|
|
|
|
class Item_func_curtime :public Item_str_timefunc
|
|
{
|
|
longlong value;
|
|
char buff[9*2+32];
|
|
uint buff_length;
|
|
public:
|
|
Item_func_curtime() :Item_str_timefunc() {}
|
|
Item_func_curtime(Item *a) :Item_str_timefunc(a) {}
|
|
double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
|
longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
|
|
String *val_str(String *str);
|
|
void fix_length_and_dec();
|
|
/*
|
|
Abstract method that defines which time zone is used for conversion.
|
|
Converts time current time in my_time_t representation to broken-down
|
|
TIME representation using UTC-SYSTEM or per-thread time zone.
|
|
*/
|
|
virtual void store_now_in_TIME(TIME *now_time)=0;
|
|
bool result_as_longlong() { return TRUE; }
|
|
};
|
|
|
|
|
|
class Item_func_curtime_local :public Item_func_curtime
|
|
{
|
|
public:
|
|
Item_func_curtime_local() :Item_func_curtime() {}
|
|
Item_func_curtime_local(Item *a) :Item_func_curtime(a) {}
|
|
const char *func_name() const { return "curtime"; }
|
|
virtual void store_now_in_TIME(TIME *now_time);
|
|
};
|
|
|
|
|
|
class Item_func_curtime_utc :public Item_func_curtime
|
|
{
|
|
public:
|
|
Item_func_curtime_utc() :Item_func_curtime() {}
|
|
Item_func_curtime_utc(Item *a) :Item_func_curtime(a) {}
|
|
const char *func_name() const { return "utc_time"; }
|
|
virtual void store_now_in_TIME(TIME *now_time);
|
|
};
|
|
|
|
|
|
/* Abstract CURDATE function. See also Item_func_curtime. */
|
|
|
|
class Item_func_curdate :public Item_date
|
|
{
|
|
longlong value;
|
|
TIME ltime;
|
|
public:
|
|
Item_func_curdate() :Item_date() {}
|
|
longlong val_int() { DBUG_ASSERT(fixed == 1); return (value) ; }
|
|
String *val_str(String *str);
|
|
void fix_length_and_dec();
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
virtual void store_now_in_TIME(TIME *now_time)=0;
|
|
};
|
|
|
|
|
|
class Item_func_curdate_local :public Item_func_curdate
|
|
{
|
|
public:
|
|
Item_func_curdate_local() :Item_func_curdate() {}
|
|
const char *func_name() const { return "curdate"; }
|
|
void store_now_in_TIME(TIME *now_time);
|
|
};
|
|
|
|
|
|
class Item_func_curdate_utc :public Item_func_curdate
|
|
{
|
|
public:
|
|
Item_func_curdate_utc() :Item_func_curdate() {}
|
|
const char *func_name() const { return "utc_date"; }
|
|
void store_now_in_TIME(TIME *now_time);
|
|
};
|
|
|
|
|
|
/* Abstract CURRENT_TIMESTAMP function. See also Item_func_curtime */
|
|
|
|
class Item_func_now :public Item_date_func
|
|
{
|
|
protected:
|
|
longlong value;
|
|
char buff[20*2+32]; // +32 to make my_snprintf_{8bit|ucs2} happy
|
|
uint buff_length;
|
|
TIME ltime;
|
|
public:
|
|
Item_func_now() :Item_date_func() {}
|
|
Item_func_now(Item *a) :Item_date_func(a) {}
|
|
enum Item_result result_type () const { return STRING_RESULT; }
|
|
double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
|
|
longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
|
|
int save_in_field(Field *to, bool no_conversions);
|
|
String *val_str(String *str);
|
|
void fix_length_and_dec();
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
virtual void store_now_in_TIME(TIME *now_time)=0;
|
|
};
|
|
|
|
|
|
class Item_func_now_local :public Item_func_now
|
|
{
|
|
public:
|
|
Item_func_now_local() :Item_func_now() {}
|
|
Item_func_now_local(Item *a) :Item_func_now(a) {}
|
|
const char *func_name() const { return "now"; }
|
|
virtual void store_now_in_TIME(TIME *now_time);
|
|
virtual enum Functype functype() const { return NOW_FUNC; }
|
|
};
|
|
|
|
|
|
class Item_func_now_utc :public Item_func_now
|
|
{
|
|
public:
|
|
Item_func_now_utc() :Item_func_now() {}
|
|
Item_func_now_utc(Item *a) :Item_func_now(a) {}
|
|
const char *func_name() const { return "utc_timestamp"; }
|
|
virtual void store_now_in_TIME(TIME *now_time);
|
|
};
|
|
|
|
|
|
/*
|
|
This is like NOW(), but always uses the real current time, not the
|
|
query_start(). This matches the Oracle behavior.
|
|
*/
|
|
class Item_func_sysdate_local :public Item_func_now
|
|
{
|
|
public:
|
|
Item_func_sysdate_local() :Item_func_now() {}
|
|
Item_func_sysdate_local(Item *a) :Item_func_now(a) {}
|
|
bool const_item() const { return 0; }
|
|
const char *func_name() const { return "sysdate"; }
|
|
void store_now_in_TIME(TIME *now_time);
|
|
double val_real();
|
|
longlong val_int();
|
|
int save_in_field(Field *to, bool no_conversions);
|
|
String *val_str(String *str);
|
|
void fix_length_and_dec();
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
void update_used_tables()
|
|
{
|
|
Item_func_now::update_used_tables();
|
|
used_tables_cache|= RAND_TABLE_BIT;
|
|
}
|
|
};
|
|
|
|
|
|
class Item_func_from_days :public Item_date
|
|
{
|
|
public:
|
|
Item_func_from_days(Item *a) :Item_date(a) {}
|
|
const char *func_name() const { return "from_days"; }
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_date_format :public Item_str_func
|
|
{
|
|
int fixed_length;
|
|
const bool is_time_format;
|
|
String value;
|
|
public:
|
|
Item_func_date_format(Item *a,Item *b,bool is_time_format_arg)
|
|
:Item_str_func(a,b),is_time_format(is_time_format_arg) {}
|
|
String *val_str(String *str);
|
|
const char *func_name() const
|
|
{ return is_time_format ? "time_format" : "date_format"; }
|
|
void fix_length_and_dec();
|
|
uint format_length(const String *format);
|
|
bool eq(const Item *item, bool binary_cmp) const;
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_from_unixtime :public Item_date_func
|
|
{
|
|
THD *thd;
|
|
public:
|
|
Item_func_from_unixtime(Item *a) :Item_date_func(a) {}
|
|
double val_real()
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return (double) Item_func_from_unixtime::val_int();
|
|
}
|
|
longlong val_int();
|
|
String *val_str(String *str);
|
|
const char *func_name() const { return "from_unixtime"; }
|
|
void fix_length_and_dec();
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
/*
|
|
We need Time_zone class declaration for storing pointers in
|
|
Item_func_convert_tz.
|
|
*/
|
|
class Time_zone;
|
|
|
|
/*
|
|
This class represents CONVERT_TZ() function.
|
|
The important fact about this function that it is handled in special way.
|
|
When such function is met in expression time_zone system tables are added
|
|
to global list of tables to open, so later those already opened and locked
|
|
tables can be used during this function calculation for loading time zone
|
|
descriptions.
|
|
*/
|
|
class Item_func_convert_tz :public Item_date_func
|
|
{
|
|
/* Cached pointer to list of pre-opened time zone tables. */
|
|
TABLE_LIST *tz_tables;
|
|
/*
|
|
If time zone parameters are constants we are caching objects that
|
|
represent them (we use separate from_tz_cached/to_tz_cached members
|
|
to indicate this fact, since NULL is legal value for from_tz/to_tz
|
|
members.
|
|
*/
|
|
bool from_tz_cached, to_tz_cached;
|
|
Time_zone *from_tz, *to_tz;
|
|
public:
|
|
Item_func_convert_tz(Item *a, Item *b, Item *c):
|
|
Item_date_func(a, b, c), from_tz_cached(0), to_tz_cached(0) {}
|
|
longlong val_int();
|
|
double val_real() { return (double) val_int(); }
|
|
String *val_str(String *str);
|
|
const char *func_name() const { return "convert_tz"; }
|
|
bool fix_fields(THD *, Item **);
|
|
void fix_length_and_dec();
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
void cleanup();
|
|
};
|
|
|
|
|
|
class Item_func_sec_to_time :public Item_str_timefunc
|
|
{
|
|
public:
|
|
Item_func_sec_to_time(Item *item) :Item_str_timefunc(item) {}
|
|
double val_real()
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return (double) Item_func_sec_to_time::val_int();
|
|
}
|
|
longlong val_int();
|
|
String *val_str(String *);
|
|
void fix_length_and_dec()
|
|
{
|
|
Item_str_timefunc::fix_length_and_dec();
|
|
collation.set(&my_charset_bin);
|
|
maybe_null=1;
|
|
decimals= DATETIME_DEC;
|
|
}
|
|
const char *func_name() const { return "sec_to_time"; }
|
|
bool result_as_longlong() { return TRUE; }
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_date_add_interval :public Item_date_func
|
|
{
|
|
String value;
|
|
enum_field_types cached_field_type;
|
|
|
|
public:
|
|
const interval_type int_type; // keep it public
|
|
const bool date_sub_interval; // keep it public
|
|
Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
|
|
:Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
|
|
String *val_str(String *);
|
|
const char *func_name() const { return "date_add_interval"; }
|
|
void fix_length_and_dec();
|
|
enum_field_types field_type() const { return cached_field_type; }
|
|
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
|
longlong val_int();
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
bool eq(const Item *item, bool binary_cmp) const;
|
|
void print(String *str);
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_extract :public Item_int_func
|
|
{
|
|
String value;
|
|
bool date_value;
|
|
public:
|
|
const interval_type int_type; // keep it public
|
|
Item_extract(interval_type type_arg, Item *a)
|
|
:Item_int_func(a), int_type(type_arg) {}
|
|
longlong val_int();
|
|
enum Functype functype() const { return EXTRACT_FUNC; }
|
|
const char *func_name() const { return "extract"; }
|
|
void fix_length_and_dec();
|
|
bool eq(const Item *item, bool binary_cmp) const;
|
|
void print(String *str);
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_typecast :public Item_str_func
|
|
{
|
|
public:
|
|
Item_typecast(Item *a) :Item_str_func(a) {}
|
|
String *val_str(String *a)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
String *tmp=args[0]->val_str(a);
|
|
null_value=args[0]->null_value;
|
|
if (tmp)
|
|
tmp->set_charset(collation.collation);
|
|
return tmp;
|
|
}
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
max_length=args[0]->max_length;
|
|
}
|
|
virtual const char* cast_type() const= 0;
|
|
void print(String *str);
|
|
};
|
|
|
|
|
|
class Item_typecast_maybe_null :public Item_typecast
|
|
{
|
|
public:
|
|
Item_typecast_maybe_null(Item *a) :Item_typecast(a) {}
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
max_length=args[0]->max_length;
|
|
maybe_null= 1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_char_typecast :public Item_typecast
|
|
{
|
|
int cast_length;
|
|
CHARSET_INFO *cast_cs, *from_cs;
|
|
bool charset_conversion;
|
|
String tmp_value;
|
|
public:
|
|
Item_char_typecast(Item *a, int length_arg, CHARSET_INFO *cs_arg)
|
|
:Item_typecast(a), cast_length(length_arg), cast_cs(cs_arg) {}
|
|
enum Functype functype() const { return CHAR_TYPECAST_FUNC; }
|
|
bool eq(const Item *item, bool binary_cmp) const;
|
|
const char *func_name() const { return "cast_as_char"; }
|
|
const char* cast_type() const { return "char"; };
|
|
String *val_str(String *a);
|
|
void fix_length_and_dec();
|
|
void print(String *str);
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_date_typecast :public Item_typecast_maybe_null
|
|
{
|
|
public:
|
|
Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) {}
|
|
const char *func_name() const { return "cast_as_date"; }
|
|
String *val_str(String *str);
|
|
bool get_date(TIME *ltime, uint fuzzy_date);
|
|
const char *cast_type() const { return "date"; }
|
|
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 0);
|
|
}
|
|
void fix_length_and_dec()
|
|
{
|
|
collation.set(&my_charset_bin);
|
|
max_length= 10;
|
|
maybe_null= 1;
|
|
}
|
|
bool result_as_longlong() { return TRUE; }
|
|
longlong val_int();
|
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return val_decimal_from_date(decimal_value);
|
|
}
|
|
int save_in_field(Field *field, bool no_conversions)
|
|
{
|
|
return save_date_in_field(field);
|
|
}
|
|
};
|
|
|
|
|
|
class Item_time_typecast :public Item_typecast_maybe_null
|
|
{
|
|
public:
|
|
Item_time_typecast(Item *a) :Item_typecast_maybe_null(a) {}
|
|
const char *func_name() const { return "cast_as_time"; }
|
|
String *val_str(String *str);
|
|
bool get_time(TIME *ltime);
|
|
const char *cast_type() const { return "time"; }
|
|
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 0);
|
|
}
|
|
bool result_as_longlong() { return TRUE; }
|
|
longlong val_int();
|
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return val_decimal_from_time(decimal_value);
|
|
}
|
|
int save_in_field(Field *field, bool no_conversions)
|
|
{
|
|
return save_time_in_field(field);
|
|
}
|
|
};
|
|
|
|
|
|
class Item_datetime_typecast :public Item_typecast_maybe_null
|
|
{
|
|
public:
|
|
Item_datetime_typecast(Item *a) :Item_typecast_maybe_null(a) {}
|
|
const char *func_name() const { return "cast_as_datetime"; }
|
|
String *val_str(String *str);
|
|
const char *cast_type() const { return "datetime"; }
|
|
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 0);
|
|
}
|
|
bool result_as_longlong() { return TRUE; }
|
|
longlong val_int();
|
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
return val_decimal_from_date(decimal_value);
|
|
}
|
|
int save_in_field(Field *field, bool no_conversions)
|
|
{
|
|
return save_date_in_field(field);
|
|
}
|
|
};
|
|
|
|
class Item_func_makedate :public Item_date_func
|
|
{
|
|
public:
|
|
Item_func_makedate(Item *a,Item *b) :Item_date_func(a,b) {}
|
|
String *val_str(String *str);
|
|
const char *func_name() const { return "makedate"; }
|
|
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
longlong val_int();
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_add_time :public Item_str_func
|
|
{
|
|
const bool is_date;
|
|
int sign;
|
|
enum_field_types cached_field_type;
|
|
|
|
public:
|
|
Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg)
|
|
:Item_str_func(a, b), is_date(type_arg) { sign= neg_arg ? -1 : 1; }
|
|
String *val_str(String *str);
|
|
enum_field_types field_type() const { return cached_field_type; }
|
|
void fix_length_and_dec();
|
|
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 0);
|
|
}
|
|
void print(String *str);
|
|
const char *func_name() const { return "add_time"; }
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
my_decimal *val_decimal(my_decimal *decimal_value)
|
|
{
|
|
DBUG_ASSERT(fixed == 1);
|
|
if (cached_field_type == MYSQL_TYPE_TIME)
|
|
return val_decimal_from_time(decimal_value);
|
|
if (cached_field_type == MYSQL_TYPE_DATETIME)
|
|
return val_decimal_from_date(decimal_value);
|
|
return Item_str_func::val_decimal(decimal_value);
|
|
}
|
|
int save_in_field(Field *field, bool no_conversions)
|
|
{
|
|
if (cached_field_type == MYSQL_TYPE_TIME)
|
|
return save_time_in_field(field);
|
|
if (cached_field_type == MYSQL_TYPE_DATETIME)
|
|
return save_date_in_field(field);
|
|
return Item_str_func::save_in_field(field, no_conversions);
|
|
}
|
|
};
|
|
|
|
class Item_func_timediff :public Item_str_timefunc
|
|
{
|
|
public:
|
|
Item_func_timediff(Item *a, Item *b)
|
|
:Item_str_timefunc(a, b) {}
|
|
String *val_str(String *str);
|
|
const char *func_name() const { return "timediff"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
Item_str_timefunc::fix_length_and_dec();
|
|
maybe_null= 1;
|
|
}
|
|
};
|
|
|
|
class Item_func_maketime :public Item_str_timefunc
|
|
{
|
|
public:
|
|
Item_func_maketime(Item *a, Item *b, Item *c)
|
|
:Item_str_timefunc(a, b ,c) {}
|
|
String *val_str(String *str);
|
|
const char *func_name() const { return "maketime"; }
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
class Item_func_microsecond :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_microsecond(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "microsecond"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
maybe_null=1;
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_timestamp_diff :public Item_int_func
|
|
{
|
|
const interval_type int_type;
|
|
public:
|
|
Item_func_timestamp_diff(Item *a,Item *b,interval_type type_arg)
|
|
:Item_int_func(a,b), int_type(type_arg) {}
|
|
const char *func_name() const { return "timestampdiff"; }
|
|
longlong val_int();
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=0;
|
|
maybe_null=1;
|
|
}
|
|
void print(String *str);
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
enum date_time_format
|
|
{
|
|
USA_FORMAT, JIS_FORMAT, ISO_FORMAT, EUR_FORMAT, INTERNAL_FORMAT
|
|
};
|
|
|
|
class Item_func_get_format :public Item_str_func
|
|
{
|
|
public:
|
|
const timestamp_type type; // keep it public
|
|
Item_func_get_format(timestamp_type type_arg, Item *a)
|
|
:Item_str_func(a), type(type_arg)
|
|
{}
|
|
String *val_str(String *str);
|
|
const char *func_name() const { return "get_format"; }
|
|
void fix_length_and_dec()
|
|
{
|
|
maybe_null= 1;
|
|
decimals=0;
|
|
max_length=17*MY_CHARSET_BIN_MB_MAXLEN;
|
|
}
|
|
void print(String *str);
|
|
};
|
|
|
|
|
|
class Item_func_str_to_date :public Item_str_func
|
|
{
|
|
enum_field_types cached_field_type;
|
|
date_time_format_types cached_format_type;
|
|
timestamp_type cached_timestamp_type;
|
|
bool const_item;
|
|
public:
|
|
Item_func_str_to_date(Item *a, Item *b)
|
|
:Item_str_func(a, b)
|
|
{}
|
|
String *val_str(String *str);
|
|
bool get_date(TIME *ltime, uint fuzzy_date);
|
|
const char *func_name() const { return "str_to_date"; }
|
|
enum_field_types field_type() const { return cached_field_type; }
|
|
void fix_length_and_dec();
|
|
Field *tmp_table_field(TABLE *table)
|
|
{
|
|
return tmp_table_field_from_field_type(table, 1);
|
|
}
|
|
bool check_partition_func_processor(byte *int_arg) {return FALSE;}
|
|
};
|
|
|
|
|
|
class Item_func_last_day :public Item_date
|
|
{
|
|
public:
|
|
Item_func_last_day(Item *a) :Item_date(a) {}
|
|
const char *func_name() const { return "last_day"; }
|
|
bool get_date(TIME *res, uint fuzzy_date);
|
|
};
|