summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2004-04-07 19:07:44 +0200
committerunknown <pem@mysql.com>2004-04-07 19:07:44 +0200
commit0a4401153a71c5e7cf18dc6d1641613dd52c7a3d (patch)
treee5ac1517ff3dccc42352b7bac39ecd1c093d0ae6 /sql/item_func.h
parent0a42fa7f723d6c6b3f67bede359b5b990f6f3ead (diff)
parent01bcc6ed3c4c1c6515592364b4aec0cae5d2083c (diff)
downloadmariadb-git-0a4401153a71c5e7cf18dc6d1641613dd52c7a3d.tar.gz
Merge 4.1 -> 5.0.
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union VC++Files/sql/mysqld.dsp: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged configure.in: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/mysql_com.h: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/insert_select.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/connect.result: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/mix_innodb_myisam_binlog.result: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/rpl_change_master.result: Auto merged mysql-test/r/rpl_log.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/r/rpl_flush_log_loop.result: Auto merged mysql-test/r/rpl_flush_tables.result: Auto merged mysql-test/r/rpl_loaddata.result: Auto merged mysql-test/r/rpl_loaddata_rule_m.result: Auto merged mysql-test/r/rpl_loaddata_rule_s.result: Auto merged mysql-test/r/rpl_max_relay_size.result: Auto merged mysql-test/r/rpl_reset_slave.result: Auto merged mysql-test/r/rpl_temporary.result: Auto merged mysql-test/r/rpl_until.result: Auto merged mysql-test/r/rpl_user_variables.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/func_sapdb.test: Auto merged mysql-test/t/mix_innodb_myisam_binlog.test: Auto merged mysql-test/t/mysqlbinlog.test: Auto merged mysql-test/t/rpl_change_master.test: Auto merged mysql-test/t/rpl_log.test: Auto merged mysql-test/t/variables.test: Auto merged netware/BUILD/compile-linux-tools: Auto merged netware/BUILD/compile-netware-END: Auto merged netware/BUILD/compile-netware-all: Auto merged netware/BUILD/compile-netware-standard: Auto merged mysql-test/t/rpl_empty_master_crash.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysql-test/t/rpl_flush_log_loop.test: Auto merged mysql-test/t/rpl_loaddata.test: Auto merged mysql-test/t/rpl_loaddata_rule_m.test: Auto merged mysql-test/t/rpl_loaddata_rule_s.test: Auto merged mysql-test/t/rpl_max_relay_size.test: Auto merged mysql-test/t/rpl_openssl.test: Auto merged mysql-test/t/rpl_relayrotate-slave.opt: Auto merged mysql-test/t/rpl_reset_slave.test: Auto merged mysql-test/t/rpl_trunc_binlog.test: Auto merged mysql-test/t/rpl_until.test: Auto merged mysql-test/t/rpl_user_variables.test: Auto merged mysql-test/t/subselect.test: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged scripts/mysql_install_db.sh: Auto merged sql/filesort.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_berkeley.h: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.h: Auto merged sql/lock.cc: Auto merged sql/log_event.h: Auto merged sql/mysqld.cc: Auto merged sql/net_serv.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/repl_failsafe.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_test.cc: Auto merged sql/sql_update.cc: Auto merged sql-common/client.c: Auto merged tests/client_test.c: Auto merged
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h49
1 files changed, 30 insertions, 19 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index 6d313a8ea66..435615531b2 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -47,7 +47,7 @@ public:
SP_CONTAINS_FUNC,SP_OVERLAPS_FUNC,
SP_STARTPOINT,SP_ENDPOINT,SP_EXTERIORRING,
SP_POINTN,SP_GEOMETRYN,SP_INTERIORRINGN,
- NOT_FUNC, NOT_ALL_FUNC,
+ NOT_FUNC, NOT_ALL_FUNC, NOW_FUNC,
GUSERVAR_FUNC};
enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL };
enum Type type() const { return FUNC_ITEM; }
@@ -156,7 +156,7 @@ public:
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(); }
+ longlong val_int() { DBUG_ASSERT(fixed == 1); 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); }
};
@@ -170,7 +170,7 @@ 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(); }
+ longlong val_int() { DBUG_ASSERT(fixed == 1); 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; }
@@ -201,7 +201,7 @@ public:
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; }
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {}
- double val() { return (double) val_int(); }
+ double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() {}
@@ -286,7 +286,7 @@ 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(); }
+ double val() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
longlong val_int();
const char *func_name() const { return "DIV"; }
void fix_length_and_dec();
@@ -513,7 +513,7 @@ public:
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 update_used_tables();
void fix_length_and_dec();
};
@@ -585,7 +585,8 @@ 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; }
+ longlong val_int()
+ { DBUG_ASSERT(fixed == 1); return Item_func_length::val_int()*8; }
const char *func_name() const { return "bit_length"; }
};
@@ -729,13 +730,14 @@ public:
};
-class Item_func_set_last_insert_id :public Item_int_func
+class Item_func_last_insert_id :public Item_int_func
{
public:
- Item_func_set_last_insert_id(Item *a) :Item_int_func(a) {}
+ Item_func_last_insert_id() :Item_int_func() {}
+ Item_func_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; }
+ void fix_length_and_dec() { if (arg_count) max_length= args[0]->max_length; }
};
class Item_func_benchmark :public Item_int_func
@@ -766,6 +768,7 @@ public:
const char *func_name() const { return udf.name(); }
bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref)
{
+ DBUG_ASSERT(fixed == 0);
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;
@@ -783,7 +786,8 @@ class Item_func_udf_float :public Item_udf_func
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) {}
- longlong val_int() { return (longlong) Item_func_udf_float::val(); }
+ longlong val_int()
+ { DBUG_ASSERT(fixed == 1); return (longlong) Item_func_udf_float::val(); }
double val();
String *val_str(String *str);
void fix_length_and_dec() { fix_num_length_and_dec(); }
@@ -834,7 +838,7 @@ 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) {}
- double val() { return 0.0; }
+ double val() { DBUG_ASSERT(fixed == 1); return 0.0; }
};
@@ -843,7 +847,7 @@ 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) {}
- longlong val_int() { return 0; }
+ longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; }
};
@@ -852,9 +856,10 @@ 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) {}
- 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; }
+ String *val_str(String *)
+ { DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
+ double val() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; }
+ longlong val_int() { DBUG_ASSERT(fixed == 1); 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; }
};
@@ -865,9 +870,9 @@ public:
** User level locks
*/
-class ULL;
+class User_level_lock;
void item_user_lock_init(void);
-void item_user_lock_release(ULL *ull);
+void item_user_lock_release(User_level_lock *ull);
void item_user_lock_free(void);
class Item_func_get_lock :public Item_int_func
@@ -1002,6 +1007,8 @@ public:
join_key(0), ft_handler(0), table(0), master(0), concat(0) { }
void cleanup()
{
+ DBUG_ENTER("Item_func_match");
+ Item_real_func::cleanup();
if (!master && ft_handler)
{
ft_handler->please->close_search(ft_handler);
@@ -1011,7 +1018,11 @@ public:
table->fulltext_searched=0;
}
if (concat)
+ {
delete concat;
+ concat= 0;
+ }
+ DBUG_VOID_RETURN;
}
enum Functype functype() const { return FT_FUNC; }
const char *func_name() const { return "match"; }
@@ -1019,7 +1030,7 @@ public:
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; }
+ longlong val_int() { DBUG_ASSERT(fixed == 1); return val()!=0.0; }
double val();
void print(String *str);