summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-06-14 16:41:17 +0200
committerunknown <guilhem@mysql.com>2003-06-14 16:41:17 +0200
commit3345eabe5905585264267c4802f87d62e0543cb5 (patch)
tree3f074b9a7ed7ba7bc0d395ffaad619c862ae9e8a /sql
parent58d679e34f925355c9514f7be354e3d925b717d6 (diff)
parent9adfaf1b2f682871fa7577de1e32f199a2955e79 (diff)
downloadmariadb-git-3345eabe5905585264267c4802f87d62e0543cb5.tar.gz
Merge gbichot@213.136.52.20:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/item_timefunc.cc16
-rw-r--r--sql/item_timefunc.h1
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/sql_parse.cc11
4 files changed, 25 insertions, 5 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 6a95c15a226..84e7a44ac61 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1137,6 +1137,22 @@ longlong Item_extract::val_int()
return 0; // Impossible
}
+bool Item_extract::eq(const Item *item, bool binary_cmp) const
+{
+ if (this == item)
+ return 1;
+ if (item->type() != FUNC_ITEM ||
+ func_name() != ((Item_func*)item)->func_name())
+ return 0;
+
+ Item_extract* ie= (Item_extract*)item;
+ if (ie->int_type != int_type)
+ return 0;
+
+ if (!args[0]->eq(ie->args[0], binary_cmp))
+ return 0;
+ return 1;
+}
void Item_typecast::print(String *str)
{
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 0ca2a36609d..e04e24627d9 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -422,6 +422,7 @@ class Item_extract :public Item_int_func
longlong val_int();
const char *func_name() const { return "extract"; }
void fix_length_and_dec();
+ bool eq(const Item *item, bool binary_cmp) const;
unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ca98ab96710..0f3500248c0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4292,7 +4292,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_SAFEMALLOC_MEM_LIMIT:
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
- safemalloc_mem_limit = atoi(argument);
+ sf_malloc_mem_limit = atoi(argument);
#endif
break;
#ifdef EMBEDDED_LIBRARY
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7447ba44e76..3a8895ab120 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1208,9 +1208,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
opened_tables,refresh_version, cached_tables(),
uptime ? (float)thd->query_id/(float)uptime : 0);
#ifdef SAFEMALLOC
- if (lCurMemory) // Using SAFEMALLOC
+ if (sf_malloc_cur_memory) // Using SAFEMALLOC
sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK",
- (lCurMemory+1023L)/1024L,(lMaxMemory+1023L)/1024L);
+ (sf_malloc_cur_memory+1023L)/1024L,
+ (sf_malloc_max_memory+1023L)/1024L);
#endif
VOID(my_net_write(net, buff,(uint) strlen(buff)));
VOID(net_flush(net));
@@ -2476,8 +2477,10 @@ mysql_execute_command(void)
res = mysql_ha_close(thd, tables);
break;
case SQLCOM_HA_READ:
- if (check_db_used(thd,tables) ||
- check_table_access(thd,SELECT_ACL, tables))
+ /* there is no need to check for table permissions here, because
+ if a user has no permissions to read a table, he won't be
+ able to open it (with SQLCOM_HA_OPEN) in the first place. */
+ if (check_db_used(thd,tables))
goto error;
res = mysql_ha_read(thd, tables, lex->ha_read_mode, lex->backup_dir,
lex->insert_list, lex->ha_rkey_mode, select_lex->where,