mirror of
https://github.com/MariaDB/server.git
synced 2025-05-28 13:01:41 +03:00
BitKeeper/etc/logging_ok: auto-union scripts/make_win_src_distribution.old: Merge rename: scripts/make_win_src_distribution.sh -> scripts/make_win_src_distribution.old BUILD/compile-pentium-debug-max: Auto merged BitKeeper/deleted/.del-sel000001.result~383913ae4505ec86: Auto merged BitKeeper/deleted/.del-sel000001.test~9567c1646058cc: Auto merged Build-tools/Bootstrap: Auto merged Build-tools/Do-compile: Auto merged Docs/Makefile.am: Auto merged client/get_password.c: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged extra/perror.c: Auto merged include/config-win.h: Auto merged include/my_sys.h: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/btr/btr0pcur.c: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/buf/buf0flu.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/include/buf0buf.h: Auto merged innobase/include/log0recv.h: Auto merged innobase/include/row0sel.h: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/ut0mem.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0log.c: Auto merged innobase/mem/mem0pool.c: Auto merged innobase/os/os0file.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/ut/ut0mem.c: Auto merged innobase/ut/ut0ut.c: Auto merged myisam/ft_boolean_search.c: Auto merged myisam/mi_check.c: Auto merged myisam/mi_extra.c: Auto merged myisam/mi_key.c: Auto merged myisam/myisamdef.h: Auto merged myisammrg/myrg_queue.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/flush.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/grant_cache.result: Auto merged mysql-test/r/join.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/rpl000018.result: Auto merged mysql-test/r/rpl_insert_id.result: Auto merged mysql-test/r/rpl_master_pos_wait.result: Auto merged mysql-test/r/rpl_relayspace.result: Auto merged mysql-test/r/select_safe.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/r/type_datetime.result: Auto merged mysql-test/t/alias.test: Auto merged mysql-test/t/ctype_latin1_de.test: Auto merged mysql-test/t/fulltext_left_join.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/handler.test: Auto merged mysql-test/t/heap.test: Auto merged mysql-test/t/join.test: Auto merged mysql-test/t/join_outer.test: Auto merged mysql-test/t/order_by.test: Auto merged mysql-test/t/range.test: Auto merged mysql-test/t/rpl000001.test: Auto merged mysql-test/t/rpl000018.test: Auto merged mysql-test/t/rpl_insert_id.test: Auto merged mysql-test/t/sel000100.test: Auto merged mysql-test/t/select_safe.test: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/user_var.test: Auto merged mysys/default.c: Auto merged mysys/mf_format.c: Auto merged mysys/my_getopt.c: Auto merged mysys/thr_lock.c: Auto merged mysys/tree.c: Auto merged scripts/Makefile.am: Auto merged scripts/mysql_install_db.sh: Auto merged scripts/mysqld_safe.sh: Auto merged sql/Makefile.am: Auto merged sql/field_conv.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/net_serv.cc: Auto merged sql/nt_servc.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_update.cc: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/uniques.cc: Auto merged support-files/mysql.spec.sh: Auto merged vio/viosocket.c: Auto merged BitKeeper/deleted/.del-ctype-latin1_de.c~c5d8f9208bceb98e: merge BitKeeper/deleted/.del-mini_client.cc~8677895ec8169183: merge acinclude.m4: Merge with 4.0 (openssl patch) client/mysqlbinlog.cc: Merge with 4.0 in which we had added code from 4.1 (We are basicly only using the 4.1 code here) configure.in: Keep 4.1 file heap/hp_open.c: merge with 4.0 include/my_base.h: merge with 4.0 include/my_global.h: merge with 4.0 include/mysqld_error.h: merge with 4.0 innobase/ha/ha0ha.c: merge with 4.0 (Code should be same but we use indentaion from 4.0) innobase/log/log0recv.c: merge with 4.0 libmysql/libmysql.c: Remove with 4.0 code that was ported from 4.1 libmysqld/lib_sql.cc: merge with 4.0 myisam/mi_open.c: Remove 4.0 specific code myisam/myisamchk.c: merge with 4.0 myisammrg/myrg_rkey.c: merge with 4.0 mysql-test/r/alter_table.result: May need to be fixed after merge mysql-test/r/create.result: May need to be fixed after merge mysql-test/r/distinct.result: May need to be fixed after merge mysql-test/r/drop.result: May need to be fixed after merge mysql-test/r/fulltext.result: May need to be fixed after merge mysql-test/r/func_set.result: May need to be fixed after merge mysql-test/r/func_str.result: May need to be fixed after merge mysql-test/r/func_test.result: May need to be fixed after merge mysql-test/r/grant.result: May need to be fixed after merge mysql-test/r/group_by.result: May need to be fixed after merge mysql-test/r/handler.result: May need to be fixed after merge mysql-test/r/heap.result: May need to be fixed after merge mysql-test/r/innodb.result: May need to be fixed after merge mysql-test/r/insert.result: May need to be fixed after merge mysql-test/r/insert_select.result: May need to be fixed after merge mysql-test/r/key_diff.result: May need to be fixed after merge mysql-test/r/merge.result: May need to be fixed after merge mysql-test/r/myisam.result: May need to be fixed after merge mysql-test/r/order_by.result: May need to be fixed after merge mysql-test/r/query_cache.result: May need to be fixed after merge mysql-test/r/rpl_flush_log_loop.result: May need to be fixed after merge mysql-test/r/rpl_loaddata.result: May need to be fixed after merge mysql-test/r/rpl_log.result: May need to be fixed after merge mysql-test/r/rpl_log_pos.result: May need to be fixed after merge mysql-test/r/rpl_rotate_logs.result: May need to be fixed after merge mysql-test/r/select.result: May need to be fixed after merge mysql-test/r/union.result: May need to be fixed after merge mysql-test/r/user_var.result: May need to be fixed after merge mysql-test/t/alter_table.test: merge with 4.0 mysql-test/t/create.test: merge with 4.0 mysql-test/t/distinct.test: merge with 4.0 mysql-test/t/drop.test: merge with 4.0 mysql-test/t/flush.test: merge with 4.0 mysql-test/t/fulltext.test: merge with 4.0 mysql-test/t/func_set.test: merge with 4.0 mysql-test/t/func_str.test: merge with 4.0 mysql-test/t/func_test.test: merge with 4.0 mysql-test/t/grant.test: merge with 4.0 mysql-test/t/grant_cache.test: merge with 4.0 mysql-test/t/innodb.test: Add back EXPLAIN and SHOW KEYS statements, but make them independent of number of rows returned by InnoDB mysql-test/t/insert.test: merge with 4.0 mysql-test/t/insert_select.test: merge with 4.0 mysql-test/t/merge.test: merge with 4.0 mysql-test/t/query_cache.test: merge with 4.0 mysql-test/t/rpl_flush_log_loop.test: merge with 4.0 mysql-test/t/rpl_loaddata.test: merge with 4.0 mysql-test/t/rpl_rotate_logs.test: merge with 4.0 mysql-test/t/select.test: merge with 4.0 mysql-test/t/symlink.test: merge with 4.0 mysql-test/t/union.test: merge with 4.0 mysys/charset.c: merge with 4.0 scripts/mysql_fix_privilege_tables.sh: merge with 4.0 (Add quoting for some variables) sql/field.h: merge with 4.0 sql/ha_innodb.cc: merge with 4.0 sql/item_cmpfunc.cc: merge with 4.0 sql/item_cmpfunc.h: merge with 4.0 sql/item_func.h: merge with 4.0 sql/item_strfunc.cc: merge with 4.0 Fixed null handling with ELT() sql/item_timefunc.h: merge with 4.0 sql/lex.h: merge with 4.0 sql/log.cc: merge with 4.0 sql/log_event.cc: Merge with 4.0 Cleanups: - Indentation - #endif comments - Replace strmov() with *pos++= for two byte strings - Moved variable declarations to start of functions - Merged identical code (LOAD_EVENT) - Added casts when subtracting pointers Did a full diff between this and 4.0 to ensure that the file is correct after merge. sql/log_event.h: merge with 4.0 sql/mysql_priv.h: merge with 4.0 sql/mysqld.cc: merge with 4.0 sql/repl_failsafe.cc: merge with 4.0 sql/set_var.cc: merge with 4.0 sql/set_var.h: merge with 4.0 sql/share/czech/errmsg.txt: merge with 4.0 sql/share/danish/errmsg.txt: merge with 4.0 sql/share/dutch/errmsg.txt: merge with 4.0 sql/share/english/errmsg.txt: merge with 4.0 sql/share/estonian/errmsg.txt: merge with 4.0 sql/share/french/errmsg.txt: merge with 4.0 sql/share/german/errmsg.txt: merge with 4.0 sql/share/greek/errmsg.txt: merge with 4.0 sql/share/hungarian/errmsg.txt: merge with 4.0 sql/share/italian/errmsg.txt: merge with 4.0 sql/share/japanese/errmsg.txt: merge with 4.0 sql/share/korean/errmsg.txt: merge with 4.0 sql/share/norwegian-ny/errmsg.txt: merge with 4.0 sql/share/norwegian/errmsg.txt: merge with 4.0 sql/share/polish/errmsg.txt: merge with 4.0 sql/share/portuguese/errmsg.txt: merge with 4.0 sql/share/romanian/errmsg.txt: merge with 4.0 sql/share/russian/errmsg.txt: merge with 4.0 sql/share/slovak/errmsg.txt: merge with 4.0 sql/share/spanish/errmsg.txt: merge with 4.0 sql/share/swedish/errmsg.txt: merge with 4.0 sql/share/ukrainian/errmsg.txt: merge with 4.0 sql/slave.cc: Merge + some indentation fixes sql/slave.h: merge with 4.0 sql/sql_acl.cc: merge with 4.0 Some end space removal to make it easier to do future merges sql/sql_acl.h: merge with 4.0 sql/sql_cache.cc: merge with 4.0 sql/sql_class.h: merge with 4.0 sql/sql_handler.cc: merge with 4.0 sql/sql_lex.cc: merge with 4.0 sql/sql_lex.h: merge with 4.0 sql/sql_parse.cc: merge with 4.0 sql/sql_repl.cc: merge with 4.0 sql/sql_select.cc: merge with 4.0 sql/sql_table.cc: merge with 4.0 sql/sql_union.cc: Merge with 4.0 Note that I couldn't find out how to merge OPTION_FOUND_ROWS handling so this has to be fixed later sql/sql_yacc.yy: merge with 4.0 Removed end space to make merge easier vio/Makefile.am: merge with 4.0
1077 lines
28 KiB
C++
1077 lines
28 KiB
C++
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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; 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 */
|
|
|
|
|
|
/* Function items used by mysql */
|
|
|
|
#ifdef __GNUC__
|
|
#pragma interface /* gcc class implementation */
|
|
#endif
|
|
|
|
#ifdef HAVE_IEEEFP_H
|
|
extern "C" /* Bug in BSDI include file */
|
|
{
|
|
#include <ieeefp.h>
|
|
}
|
|
#endif
|
|
|
|
class Item_func :public Item_result_field
|
|
{
|
|
protected:
|
|
Item **args, *tmp_arg[2];
|
|
uint allowed_arg_cols;
|
|
public:
|
|
uint arg_count;
|
|
table_map used_tables_cache, not_null_tables_cache;
|
|
bool const_item_cache;
|
|
enum Functype { UNKNOWN_FUNC,EQ_FUNC,EQUAL_FUNC,NE_FUNC,LT_FUNC,LE_FUNC,
|
|
GE_FUNC,GT_FUNC,FT_FUNC,
|
|
LIKE_FUNC,NOTLIKE_FUNC,ISNULL_FUNC,ISNOTNULL_FUNC,
|
|
COND_AND_FUNC, COND_OR_FUNC, COND_XOR_FUNC, BETWEEN, IN_FUNC,
|
|
INTERVAL_FUNC,
|
|
SP_EQUALS_FUNC, SP_DISJOINT_FUNC,SP_INTERSECTS_FUNC,
|
|
SP_TOUCHES_FUNC,SP_CROSSES_FUNC,SP_WITHIN_FUNC,
|
|
SP_CONTAINS_FUNC,SP_OVERLAPS_FUNC,
|
|
SP_STARTPOINT,SP_ENDPOINT,SP_EXTERIORRING,
|
|
SP_POINTN,SP_GEOMETRYN,SP_INTERIORRINGN};
|
|
enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL };
|
|
enum Type type() const { return FUNC_ITEM; }
|
|
virtual enum Functype functype() const { return UNKNOWN_FUNC; }
|
|
Item_func(void):
|
|
allowed_arg_cols(1), arg_count(0)
|
|
{
|
|
with_sum_func= 0;
|
|
}
|
|
Item_func(Item *a):
|
|
allowed_arg_cols(1), arg_count(1)
|
|
{
|
|
args= tmp_arg;
|
|
args[0]= a;
|
|
with_sum_func= a->with_sum_func;
|
|
}
|
|
Item_func(Item *a,Item *b):
|
|
allowed_arg_cols(1), arg_count(2)
|
|
{
|
|
args= tmp_arg;
|
|
args[0]= a; args[1]= b;
|
|
with_sum_func= a->with_sum_func || b->with_sum_func;
|
|
}
|
|
Item_func(Item *a,Item *b,Item *c):
|
|
allowed_arg_cols(1)
|
|
{
|
|
arg_count= 0;
|
|
if ((args= (Item**) sql_alloc(sizeof(Item*)*3)))
|
|
{
|
|
arg_count= 3;
|
|
args[0]= a; args[1]= b; args[2]= c;
|
|
with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
|
|
}
|
|
}
|
|
Item_func(Item *a,Item *b,Item *c,Item *d):
|
|
allowed_arg_cols(1)
|
|
{
|
|
arg_count= 0;
|
|
if ((args= (Item**) sql_alloc(sizeof(Item*)*4)))
|
|
{
|
|
arg_count= 4;
|
|
args[0]= a; args[1]= b; args[2]= c; args[3]= d;
|
|
with_sum_func= a->with_sum_func || b->with_sum_func ||
|
|
c->with_sum_func || d->with_sum_func;
|
|
}
|
|
}
|
|
Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
|
|
allowed_arg_cols(1)
|
|
{
|
|
arg_count= 5;
|
|
if ((args= (Item**) sql_alloc(sizeof(Item*)*5)))
|
|
{
|
|
args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
|
|
with_sum_func= a->with_sum_func || b->with_sum_func ||
|
|
c->with_sum_func || d->with_sum_func || e->with_sum_func ;
|
|
}
|
|
}
|
|
Item_func(List<Item> &list);
|
|
~Item_func() {} /* Nothing to do; Items are freed automaticly */
|
|
bool fix_fields(THD *,struct st_table_list *, Item **ref);
|
|
table_map used_tables() const;
|
|
table_map not_null_tables() const;
|
|
void update_used_tables();
|
|
bool eq(const Item *item, bool binary_cmp) const;
|
|
virtual optimize_type select_optimize() const { return OPTIMIZE_NONE; }
|
|
virtual bool have_rev_func() const { return 0; }
|
|
virtual Item *key_item() const { return args[0]; }
|
|
virtual const char *func_name() const { return "?"; }
|
|
virtual bool const_item() const { return const_item_cache; }
|
|
inline Item **arguments() const { return args; }
|
|
void set_arguments(List<Item> &list);
|
|
inline uint argument_count() const { return arg_count; }
|
|
inline void remove_arguments() { arg_count=0; }
|
|
virtual void split_sum_func(Item **ref_pointer_array, List<Item> &fields);
|
|
void print(String *str);
|
|
void print_op(String *str);
|
|
void fix_num_length_and_dec();
|
|
inline bool get_arg0_date(TIME *ltime,bool fuzzy_date)
|
|
{
|
|
return (null_value=args[0]->get_date(ltime,fuzzy_date));
|
|
}
|
|
inline bool get_arg0_time(TIME *ltime)
|
|
{
|
|
return (null_value=args[0]->get_time(ltime));
|
|
}
|
|
bool is_null() { (void) val_int(); return null_value; }
|
|
friend class udf_handler;
|
|
Field *tmp_table_field() { return result_field; }
|
|
Field *tmp_table_field(TABLE *t_arg);
|
|
void set_outer_resolving();
|
|
Item *get_tmp_table_item(THD *thd);
|
|
|
|
bool agg_arg_collations(DTCollation &c, Item **items, uint nitems);
|
|
bool agg_arg_collations_for_comparison(DTCollation &c, Item **items, uint nitems);
|
|
};
|
|
|
|
|
|
class Item_real_func :public Item_func
|
|
{
|
|
public:
|
|
Item_real_func() :Item_func() {}
|
|
Item_real_func(Item *a) :Item_func(a) {}
|
|
Item_real_func(Item *a,Item *b) :Item_func(a,b) {}
|
|
Item_real_func(List<Item> &list) :Item_func(list) {}
|
|
String *val_str(String*str);
|
|
longlong val_int() { return (longlong) val(); }
|
|
enum Item_result result_type () const { return REAL_RESULT; }
|
|
void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
|
|
};
|
|
|
|
|
|
class Item_num_func :public Item_func
|
|
{
|
|
protected:
|
|
Item_result hybrid_type;
|
|
public:
|
|
Item_num_func(Item *a) :Item_func(a),hybrid_type(REAL_RESULT) {}
|
|
Item_num_func(Item *a,Item *b) :Item_func(a,b),hybrid_type(REAL_RESULT) {}
|
|
String *val_str(String*str);
|
|
longlong val_int() { return (longlong) val(); }
|
|
enum Item_result result_type () const { return hybrid_type; }
|
|
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
|
bool is_null() { (void) val(); return null_value; }
|
|
};
|
|
|
|
|
|
class Item_num_op :public Item_func
|
|
{
|
|
protected:
|
|
Item_result hybrid_type;
|
|
public:
|
|
Item_num_op(Item *a,Item *b) :Item_func(a,b),hybrid_type(REAL_RESULT) {}
|
|
String *val_str(String*str);
|
|
void print(String *str) { print_op(str); }
|
|
enum Item_result result_type () const { return hybrid_type; }
|
|
void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); }
|
|
void find_num_type(void);
|
|
bool is_null() { (void) val(); return null_value; }
|
|
};
|
|
|
|
|
|
class Item_int_func :public Item_func
|
|
{
|
|
public:
|
|
Item_int_func() :Item_func() { max_length=21; }
|
|
Item_int_func(Item *a) :Item_func(a) { max_length=21; }
|
|
Item_int_func(Item *a,Item *b) :Item_func(a,b) { max_length=21; }
|
|
Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c) { max_length=21; }
|
|
Item_int_func(List<Item> &list) :Item_func(list) { max_length=21; }
|
|
double val() { return (double) val_int(); }
|
|
String *val_str(String*str);
|
|
enum Item_result result_type () const { return INT_RESULT; }
|
|
void fix_length_and_dec() {}
|
|
};
|
|
|
|
|
|
class Item_func_signed :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_signed(Item *a) :Item_int_func(a) {}
|
|
double val() { return args[0]->val(); }
|
|
longlong val_int() { return args[0]->val_int(); }
|
|
void fix_length_and_dec()
|
|
{ max_length=args[0]->max_length; unsigned_flag=0; }
|
|
};
|
|
|
|
|
|
class Item_func_unsigned :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_unsigned(Item *a) :Item_int_func(a) {}
|
|
double val() { return args[0]->val(); }
|
|
longlong val_int() { return args[0]->val_int(); }
|
|
void fix_length_and_dec()
|
|
{ max_length=args[0]->max_length; unsigned_flag=1; }
|
|
};
|
|
|
|
|
|
class Item_func_plus :public Item_num_op
|
|
{
|
|
public:
|
|
Item_func_plus(Item *a,Item *b) :Item_num_op(a,b) {}
|
|
const char *func_name() const { return "+"; }
|
|
double val();
|
|
longlong val_int();
|
|
};
|
|
|
|
class Item_func_minus :public Item_num_op
|
|
{
|
|
public:
|
|
Item_func_minus(Item *a,Item *b) :Item_num_op(a,b) {}
|
|
const char *func_name() const { return "-"; }
|
|
double val();
|
|
longlong val_int();
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_mul :public Item_num_op
|
|
{
|
|
public:
|
|
Item_func_mul(Item *a,Item *b) :Item_num_op(a,b) {}
|
|
const char *func_name() const { return "*"; }
|
|
double val();
|
|
longlong val_int();
|
|
};
|
|
|
|
|
|
class Item_func_div :public Item_num_op
|
|
{
|
|
public:
|
|
Item_func_div(Item *a,Item *b) :Item_num_op(a,b) {}
|
|
double val();
|
|
longlong val_int();
|
|
const char *func_name() const { return "/"; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_int_div :public Item_num_op
|
|
{
|
|
public:
|
|
Item_func_int_div(Item *a,Item *b) :Item_num_op(a,b)
|
|
{ hybrid_type=INT_RESULT; }
|
|
double val() { return (double) val_int(); }
|
|
longlong val_int();
|
|
const char *func_name() const { return "DIV"; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_mod :public Item_num_op
|
|
{
|
|
public:
|
|
Item_func_mod(Item *a,Item *b) :Item_num_op(a,b) {}
|
|
double val();
|
|
longlong val_int();
|
|
const char *func_name() const { return "%"; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_neg :public Item_num_func
|
|
{
|
|
public:
|
|
Item_func_neg(Item *a) :Item_num_func(a) {}
|
|
double val();
|
|
longlong val_int();
|
|
const char *func_name() const { return "-"; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_abs :public Item_num_func
|
|
{
|
|
public:
|
|
Item_func_abs(Item *a) :Item_num_func(a) {}
|
|
const char *func_name() const { return "abs"; }
|
|
double val();
|
|
longlong val_int();
|
|
enum Item_result result_type () const
|
|
{ return args[0]->result_type() == INT_RESULT ? INT_RESULT : REAL_RESULT; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
// A class to handle logaritmic and trigometric functions
|
|
|
|
class Item_dec_func :public Item_real_func
|
|
{
|
|
public:
|
|
Item_dec_func(Item *a) :Item_real_func(a) {}
|
|
Item_dec_func(Item *a,Item *b) :Item_real_func(a,b) {}
|
|
void fix_length_and_dec()
|
|
{
|
|
decimals=6; max_length=float_length(decimals);
|
|
maybe_null=1;
|
|
}
|
|
inline double fix_result(double value)
|
|
{
|
|
#ifndef HAVE_FINITE
|
|
return value;
|
|
#else
|
|
if (finite(value) && value != POSTFIX_ERROR)
|
|
return value;
|
|
null_value=1;
|
|
return 0.0;
|
|
#endif
|
|
}
|
|
};
|
|
|
|
class Item_func_exp :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_exp(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "exp"; }
|
|
};
|
|
|
|
|
|
class Item_func_ln :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_ln(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "ln"; }
|
|
};
|
|
|
|
|
|
class Item_func_log :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_log(Item *a) :Item_dec_func(a) {}
|
|
Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
|
|
double val();
|
|
const char *func_name() const { return "log"; }
|
|
};
|
|
|
|
|
|
class Item_func_log2 :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_log2(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "log2"; }
|
|
};
|
|
|
|
|
|
class Item_func_log10 :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_log10(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "log10"; }
|
|
};
|
|
|
|
|
|
class Item_func_sqrt :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_sqrt(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "sqrt"; }
|
|
};
|
|
|
|
|
|
class Item_func_pow :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
|
|
double val();
|
|
const char *func_name() const { return "pow"; }
|
|
};
|
|
|
|
|
|
class Item_func_acos :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_acos(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "acos"; }
|
|
};
|
|
|
|
class Item_func_asin :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_asin(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "asin"; }
|
|
};
|
|
|
|
class Item_func_atan :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_atan(Item *a) :Item_dec_func(a) {}
|
|
Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
|
|
double val();
|
|
const char *func_name() const { return "atan"; }
|
|
};
|
|
|
|
class Item_func_cos :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_cos(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "cos"; }
|
|
};
|
|
|
|
class Item_func_sin :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_sin(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "sin"; }
|
|
};
|
|
|
|
class Item_func_tan :public Item_dec_func
|
|
{
|
|
public:
|
|
Item_func_tan(Item *a) :Item_dec_func(a) {}
|
|
double val();
|
|
const char *func_name() const { return "tan"; }
|
|
};
|
|
|
|
class Item_func_integer :public Item_int_func
|
|
{
|
|
public:
|
|
inline Item_func_integer(Item *a) :Item_int_func(a) {}
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_ceiling :public Item_func_integer
|
|
{
|
|
Item_func_ceiling(); /* Never called */
|
|
public:
|
|
Item_func_ceiling(Item *a) :Item_func_integer(a) {}
|
|
const char *func_name() const { return "ceiling"; }
|
|
longlong val_int();
|
|
};
|
|
|
|
class Item_func_floor :public Item_func_integer
|
|
{
|
|
public:
|
|
Item_func_floor(Item *a) :Item_func_integer(a) {}
|
|
const char *func_name() const { return "floor"; }
|
|
longlong val_int();
|
|
};
|
|
|
|
/* This handles round and truncate */
|
|
|
|
class Item_func_round :public Item_real_func
|
|
{
|
|
bool truncate;
|
|
public:
|
|
Item_func_round(Item *a,Item *b,bool trunc_arg)
|
|
:Item_real_func(a,b),truncate(trunc_arg) {}
|
|
const char *func_name() const { return truncate ? "truncate" : "round"; }
|
|
double val();
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_rand :public Item_real_func
|
|
{
|
|
struct rand_struct *rand;
|
|
public:
|
|
Item_func_rand(Item *a) :Item_real_func(a) {}
|
|
Item_func_rand() :Item_real_func() {}
|
|
double val();
|
|
const char *func_name() const { return "rand"; }
|
|
bool const_item() const { return 0; }
|
|
table_map used_tables() const { return RAND_TABLE_BIT; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_sign :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_sign(Item *a) :Item_int_func(a) {}
|
|
const char *func_name() const { return "sign"; }
|
|
longlong val_int();
|
|
};
|
|
|
|
|
|
class Item_func_units :public Item_real_func
|
|
{
|
|
char *name;
|
|
double mul,add;
|
|
public:
|
|
Item_func_units(char *name_arg,Item *a,double mul_arg,double add_arg)
|
|
:Item_real_func(a),name(name_arg),mul(mul_arg),add(add_arg) {}
|
|
double val();
|
|
const char *func_name() const { return name; }
|
|
void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
|
|
};
|
|
|
|
|
|
class Item_func_min_max :public Item_func
|
|
{
|
|
Item_result cmp_type;
|
|
String tmp_value;
|
|
int cmp_sign;
|
|
public:
|
|
Item_func_min_max(List<Item> &list,int cmp_sign_arg) :Item_func(list),
|
|
cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg) {}
|
|
double val();
|
|
longlong val_int();
|
|
String *val_str(String *);
|
|
void fix_length_and_dec();
|
|
enum Item_result result_type () const { return cmp_type; }
|
|
};
|
|
|
|
class Item_func_min :public Item_func_min_max
|
|
{
|
|
public:
|
|
Item_func_min(List<Item> &list) :Item_func_min_max(list,1) {}
|
|
const char *func_name() const { return "least"; }
|
|
};
|
|
|
|
class Item_func_max :public Item_func_min_max
|
|
{
|
|
public:
|
|
Item_func_max(List<Item> &list) :Item_func_min_max(list,-1) {}
|
|
const char *func_name() const { return "greatest"; }
|
|
};
|
|
|
|
|
|
#ifdef HAVE_COMPRESS
|
|
class Item_func_crc32 :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_crc32(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "crc32"; }
|
|
void fix_length_and_dec() { max_length=10; }
|
|
};
|
|
class Item_func_uncompressed_length : public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_uncompressed_length(Item *a):Item_int_func(a){}
|
|
longlong val_int();
|
|
const char *func_name() const{return "uncompressed_length";}
|
|
void fix_length_and_dec() { max_length=10; }
|
|
};
|
|
#endif
|
|
|
|
class Item_func_length :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_length(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "length"; }
|
|
void fix_length_and_dec() { max_length=10; }
|
|
};
|
|
|
|
class Item_func_bit_length :public Item_func_length
|
|
{
|
|
public:
|
|
Item_func_bit_length(Item *a) :Item_func_length(a) {}
|
|
longlong val_int() { return Item_func_length::val_int()*8; }
|
|
const char *func_name() const { return "bit_length"; }
|
|
};
|
|
|
|
class Item_func_char_length :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_char_length(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "char_length"; }
|
|
void fix_length_and_dec() { max_length=10; }
|
|
};
|
|
|
|
class Item_func_coercibility :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_coercibility(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "coercibility"; }
|
|
void fix_length_and_dec() { max_length=10; }
|
|
};
|
|
|
|
class Item_func_locate :public Item_int_func
|
|
{
|
|
String value1,value2;
|
|
DTCollation cmp_collation;
|
|
public:
|
|
Item_func_locate(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
Item_func_locate(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
|
|
const char *func_name() const { return "locate"; }
|
|
longlong val_int();
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_field :public Item_int_func
|
|
{
|
|
String value,tmp;
|
|
Item_result cmp_type;
|
|
DTCollation cmp_collation;
|
|
public:
|
|
Item_func_field(List<Item> &list) :Item_int_func(list) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "field"; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_ascii :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_ascii(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "ascii"; }
|
|
void fix_length_and_dec() { max_length=3; }
|
|
};
|
|
|
|
class Item_func_ord :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_ord(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "ord"; }
|
|
};
|
|
|
|
class Item_func_find_in_set :public Item_int_func
|
|
{
|
|
String value,value2;
|
|
uint enum_value;
|
|
ulonglong enum_bit;
|
|
DTCollation cmp_collation;
|
|
public:
|
|
Item_func_find_in_set(Item *a,Item *b) :Item_int_func(a,b),enum_value(0) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "find_in_set"; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
|
|
class Item_func_bit_or :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_bit_or(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "|"; }
|
|
void fix_length_and_dec() { unsigned_flag=1; }
|
|
};
|
|
|
|
class Item_func_bit_and :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_bit_and(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "&"; }
|
|
void fix_length_and_dec() { unsigned_flag=1; }
|
|
};
|
|
|
|
class Item_func_bit_count :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_bit_count(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "bit_count"; }
|
|
void fix_length_and_dec() { max_length=2; }
|
|
};
|
|
|
|
class Item_func_shift_left :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_shift_left(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "<<"; }
|
|
void fix_length_and_dec() { unsigned_flag=1; }
|
|
};
|
|
|
|
class Item_func_shift_right :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_shift_right(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return ">>"; }
|
|
};
|
|
|
|
class Item_func_bit_neg :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_bit_neg(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "~"; }
|
|
void fix_length_and_dec() { unsigned_flag=1; }
|
|
};
|
|
|
|
class Item_func_set_last_insert_id :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_set_last_insert_id(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "last_insert_id"; }
|
|
void fix_length_and_dec() { max_length=args[0]->max_length; }
|
|
};
|
|
|
|
class Item_func_benchmark :public Item_int_func
|
|
{
|
|
ulong loop_count;
|
|
public:
|
|
Item_func_benchmark(ulong loop_count_arg,Item *expr)
|
|
:Item_int_func(expr), loop_count(loop_count_arg)
|
|
{}
|
|
longlong val_int();
|
|
const char *func_name() const { return "benchmark"; }
|
|
void fix_length_and_dec() { max_length=1; maybe_null=0; }
|
|
};
|
|
|
|
|
|
#ifdef HAVE_DLOPEN
|
|
|
|
class Item_udf_func :public Item_func
|
|
{
|
|
protected:
|
|
udf_handler udf;
|
|
|
|
public:
|
|
Item_udf_func(udf_func *udf_arg) :Item_func(), udf(udf_arg) {}
|
|
Item_udf_func(udf_func *udf_arg, List<Item> &list)
|
|
:Item_func(list), udf(udf_arg) {}
|
|
~Item_udf_func() {}
|
|
const char *func_name() const { return udf.name(); }
|
|
bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref)
|
|
{
|
|
bool res= udf.fix_fields(thd, tables, this, arg_count, args);
|
|
used_tables_cache= udf.used_tables_cache;
|
|
const_item_cache= udf.const_item_cache;
|
|
fixed= 1;
|
|
return res;
|
|
}
|
|
Item_result result_type () const { return udf.result_type(); }
|
|
table_map not_null_tables() const { return 0; }
|
|
};
|
|
|
|
|
|
class Item_func_udf_float :public Item_udf_func
|
|
{
|
|
public:
|
|
Item_func_udf_float(udf_func *udf_arg) :Item_udf_func(udf_arg) {}
|
|
Item_func_udf_float(udf_func *udf_arg, List<Item> &list)
|
|
:Item_udf_func(udf_arg,list) {}
|
|
~Item_func_udf_float() {}
|
|
longlong val_int() { return (longlong) Item_func_udf_float::val(); }
|
|
double val();
|
|
String *val_str(String *str);
|
|
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
|
};
|
|
|
|
|
|
class Item_func_udf_int :public Item_udf_func
|
|
{
|
|
public:
|
|
Item_func_udf_int(udf_func *udf_arg) :Item_udf_func(udf_arg) {}
|
|
Item_func_udf_int(udf_func *udf_arg, List<Item> &list)
|
|
:Item_udf_func(udf_arg,list) {}
|
|
~Item_func_udf_int() {}
|
|
longlong val_int();
|
|
double val() { return (double) Item_func_udf_int::val_int(); }
|
|
String *val_str(String *str);
|
|
enum Item_result result_type () const { return INT_RESULT; }
|
|
void fix_length_and_dec() { decimals=0; max_length=21; }
|
|
};
|
|
|
|
|
|
class Item_func_udf_str :public Item_udf_func
|
|
{
|
|
public:
|
|
Item_func_udf_str(udf_func *udf_arg) :Item_udf_func(udf_arg) {}
|
|
Item_func_udf_str(udf_func *udf_arg, List<Item> &list)
|
|
:Item_udf_func(udf_arg,list) {}
|
|
~Item_func_udf_str() {}
|
|
String *val_str(String *);
|
|
double val()
|
|
{
|
|
int err;
|
|
String *res; res=val_str(&str_value);
|
|
return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),0,&err) : 0.0;
|
|
}
|
|
longlong val_int()
|
|
{
|
|
int err;
|
|
String *res; res=val_str(&str_value);
|
|
return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10,(char**) 0,&err) : (longlong) 0;
|
|
}
|
|
enum Item_result result_type () const { return STRING_RESULT; }
|
|
void fix_length_and_dec();
|
|
};
|
|
|
|
#else /* Dummy functions to get sql_yacc.cc compiled */
|
|
|
|
class Item_func_udf_float :public Item_real_func
|
|
{
|
|
public:
|
|
Item_func_udf_float(udf_func *udf_arg) :Item_real_func() {}
|
|
Item_func_udf_float(udf_func *udf_arg, List<Item> &list) :Item_real_func(list) {}
|
|
~Item_func_udf_float() {}
|
|
double val() { return 0.0; }
|
|
};
|
|
|
|
|
|
class Item_func_udf_int :public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_udf_int(udf_func *udf_arg) :Item_int_func() {}
|
|
Item_func_udf_int(udf_func *udf_arg, List<Item> &list) :Item_int_func(list) {}
|
|
~Item_func_udf_int() {}
|
|
longlong val_int() { return 0; }
|
|
};
|
|
|
|
|
|
class Item_func_udf_str :public Item_func
|
|
{
|
|
public:
|
|
Item_func_udf_str(udf_func *udf_arg) :Item_func() {}
|
|
Item_func_udf_str(udf_func *udf_arg, List<Item> &list) :Item_func(list) {}
|
|
~Item_func_udf_str() {}
|
|
String *val_str(String *) { null_value=1; return 0; }
|
|
double val() { null_value=1; return 0.0; }
|
|
longlong val_int() { null_value=1; return 0; }
|
|
enum Item_result result_type () const { return STRING_RESULT; }
|
|
void fix_length_and_dec() { maybe_null=1; max_length=0; }
|
|
};
|
|
|
|
#endif /* HAVE_DLOPEN */
|
|
|
|
/*
|
|
** User level locks
|
|
*/
|
|
|
|
class ULL;
|
|
void item_user_lock_init(void);
|
|
void item_user_lock_release(ULL *ull);
|
|
void item_user_lock_free(void);
|
|
|
|
class Item_func_get_lock :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_get_lock(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "get_lock"; }
|
|
void fix_length_and_dec() { max_length=1; maybe_null=1;}
|
|
};
|
|
|
|
class Item_func_release_lock :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_release_lock(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "release_lock"; }
|
|
void fix_length_and_dec() { max_length=1; maybe_null=1;}
|
|
};
|
|
|
|
/* replication functions */
|
|
|
|
class Item_master_pos_wait :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "master_pos_wait"; }
|
|
void fix_length_and_dec() { max_length=21; maybe_null=1;}
|
|
};
|
|
|
|
|
|
/* Handling of user definiable variables */
|
|
|
|
class user_var_entry;
|
|
|
|
class Item_func_set_user_var :public Item_func
|
|
{
|
|
enum Item_result cached_result_type;
|
|
LEX_STRING name;
|
|
user_var_entry *entry;
|
|
|
|
public:
|
|
Item_func_set_user_var(LEX_STRING a,Item *b)
|
|
:Item_func(b), cached_result_type(INT_RESULT), name(a)
|
|
{}
|
|
double val();
|
|
longlong val_int();
|
|
String *val_str(String *str);
|
|
void update_hash(void *ptr, uint length, enum Item_result type,
|
|
CHARSET_INFO *cs, Derivation dv);
|
|
bool update();
|
|
enum Item_result result_type () const { return cached_result_type; }
|
|
bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref);
|
|
void fix_length_and_dec();
|
|
void print(String *str);
|
|
const char *func_name() const { return "set_user_var"; }
|
|
};
|
|
|
|
|
|
class Item_func_get_user_var :public Item_func
|
|
{
|
|
LEX_STRING name;
|
|
user_var_entry *var_entry;
|
|
|
|
public:
|
|
Item_func_get_user_var(LEX_STRING a):
|
|
Item_func(), name(a) {}
|
|
user_var_entry *get_entry();
|
|
double val();
|
|
longlong val_int();
|
|
String *val_str(String* str);
|
|
void fix_length_and_dec();
|
|
void print(String *str);
|
|
enum Item_result result_type() const;
|
|
/*
|
|
We must always return variables as strings to guard against selects of type
|
|
select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
|
|
*/
|
|
enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
|
|
const char *func_name() const { return "get_user_var"; }
|
|
bool const_item() const;
|
|
table_map used_tables() const
|
|
{ return const_item() ? 0 : RAND_TABLE_BIT; }
|
|
bool eq(const Item *item, bool binary_cmp) const;
|
|
};
|
|
|
|
|
|
class Item_func_inet_aton : public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_inet_aton(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "inet_aton"; }
|
|
void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;}
|
|
};
|
|
|
|
|
|
/* for fulltext search */
|
|
#include <ft_global.h>
|
|
|
|
class Item_func_match :public Item_real_func
|
|
{
|
|
public:
|
|
List<Item> fields;
|
|
String value;
|
|
TABLE *table;
|
|
Item_func_match *master;
|
|
FT_INFO * ft_handler;
|
|
Item *concat;
|
|
byte *record;
|
|
uint key, mode;
|
|
bool join_key;
|
|
|
|
Item_func_match(List<Item> &a, Item *b): Item_real_func(b),
|
|
fields(a), table(0), master(0), ft_handler(0),
|
|
concat(0), key(0), join_key(0)
|
|
{}
|
|
~Item_func_match()
|
|
{
|
|
if (!master && ft_handler)
|
|
{
|
|
ft_handler->please->close_search(ft_handler);
|
|
ft_handler=0;
|
|
if (join_key)
|
|
table->file->ft_handler=0;
|
|
table->fulltext_searched=0;
|
|
}
|
|
if (concat)
|
|
delete concat;
|
|
}
|
|
enum Functype functype() const { return FT_FUNC; }
|
|
void update_used_tables() {}
|
|
table_map not_null_tables() const { return 0; }
|
|
bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref);
|
|
bool eq(const Item *, bool binary_cmp) const;
|
|
longlong val_int() { return val()!=0.0; }
|
|
double val();
|
|
|
|
bool fix_index();
|
|
void init_search(bool no_order);
|
|
void set_outer_resolving();
|
|
};
|
|
|
|
|
|
class Item_func_match_nl :public Item_func_match
|
|
{
|
|
public:
|
|
Item_func_match_nl(List<Item> &a, Item *b)
|
|
:Item_func_match(a,b)
|
|
{ mode=FT_NL; }
|
|
const char *func_name() const { return "match_nl"; }
|
|
};
|
|
|
|
|
|
class Item_func_match_bool :public Item_func_match
|
|
{
|
|
public:
|
|
Item_func_match_bool(List<Item> &a, Item *b)
|
|
:Item_func_match(a,b)
|
|
{ mode=FT_BOOL; }
|
|
const char *func_name() const { return "match_bool"; }
|
|
};
|
|
|
|
|
|
class Item_func_bit_xor : public Item_int_func
|
|
{
|
|
public:
|
|
Item_func_bit_xor(Item *a,Item *b) :Item_int_func(a,b) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "^"; }
|
|
void fix_length_xor_dec() { unsigned_flag=1; }
|
|
};
|
|
|
|
class Item_func_is_free_lock :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_is_free_lock(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "check_lock"; }
|
|
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
|
|
};
|
|
|
|
class Item_func_is_used_lock :public Item_int_func
|
|
{
|
|
String value;
|
|
public:
|
|
Item_func_is_used_lock(Item *a) :Item_int_func(a) {}
|
|
longlong val_int();
|
|
const char *func_name() const { return "is_used_lock"; }
|
|
void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;}
|
|
};
|
|
|
|
/* For type casts */
|
|
|
|
enum Cast_target
|
|
{
|
|
ITEM_CAST_BINARY, ITEM_CAST_SIGNED_INT, ITEM_CAST_UNSIGNED_INT,
|
|
ITEM_CAST_DATE, ITEM_CAST_TIME, ITEM_CAST_DATETIME, ITEM_CAST_CHAR
|
|
};
|