summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-04-07 13:25:24 +0300
committerunknown <bell@sanja.is.com.ua>2004-04-07 13:25:24 +0300
commit08594c4795d9e673f8f514142489ce01954deba5 (patch)
treedece9888fe1343e2984889cfef41a8d06855dee7 /sql
parentffb47ca01e00cffd3546ed055f3220166d618a21 (diff)
downloadmariadb-git-08594c4795d9e673f8f514142489ce01954deba5.tar.gz
after review changes
sql/log_event.cc: non_cachable_table flag changed to cacheable_table sql/repl_failsafe.cc: non_cachable_table flag changed to cacheable_table sql/slave.cc: non_cachable_table flag changed to cacheable_table sql/sql_acl.cc: non_cachable_table flag changed to cacheable_table sql/sql_base.cc: non_cachable_table flag changed to cacheable_table sql/sql_cache.cc: non_cachable_table flag changed to cacheable_table sql/sql_help.cc: non_cachable_table flag changed to cacheable_table sql/sql_insert.cc: non_cachable_table flag changed to cacheable_table sql/sql_parse.cc: non_cachable_table flag changed to cacheable_table sql/sql_prepare.cc: renamed DEBUG tag sql/table.h: non_cachable_table flag changed to cacheable_table
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_acl.cc17
-rw-r--r--sql/sql_base.cc8
-rw-r--r--sql/sql_cache.cc1
-rw-r--r--sql/sql_help.cc3
-rw-r--r--sql/sql_insert.cc1
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_prepare.cc4
-rw-r--r--sql/table.h2
11 files changed, 13 insertions, 30 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index cd0324a72ca..8ee2f055fc6 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1698,7 +1698,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
tables.alias = tables.real_name = (char*)table_name;
tables.lock_type = TL_WRITE;
tables.updating= 1;
- tables.non_cachable_table= 1; // just safety for table on stack
+
// the table will be opened in mysql_load
if (table_rules_on && !tables_ok(thd, &tables))
{
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index f8b0cf31621..f254ffb3df3 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -736,7 +736,7 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
table.db= (char*) db;
table.real_name= (char*) table_name;
table.updating= 1;
- table.non_cachable_table= 1; // just safety for table on stack
+
if (!tables_ok(thd, &table))
continue;
}
diff --git a/sql/slave.cc b/sql/slave.cc
index d8bb9359727..53e72673a0e 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1216,7 +1216,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
bzero((char*) &tables,sizeof(tables));
tables.db = (char*)db;
tables.alias= tables.real_name= (char*)table_name;
- tables.non_cachable_table= 1; // just safety for table on stack
+
/* Drop the table if 'overwrite' is true */
if (overwrite && mysql_rm_table(thd,&tables,1,0)) /* drop if exists */
{
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ee049b619ea..63646dcc920 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -172,9 +172,6 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
tables[1].next=tables+2;
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
tables[0].db=tables[1].db=tables[2].db=thd->db;
- // just safety for table on stack
- tables[0].non_cachable_table= tables[1].non_cachable_table=
- tables[2].non_cachable_table= 1;
uint counter;
if (open_tables(thd, tables, &counter))
@@ -1328,7 +1325,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
bzero((char*) &tables,sizeof(tables));
tables.alias=tables.real_name=(char*) "user";
tables.db=(char*) "mysql";
- tables.non_cachable_table= 1; // just safety for table on stack
+
#ifdef HAVE_REPLICATION
/*
GRANT and REVOKE are applied the slave in/exclusion rules as they are
@@ -1386,7 +1383,7 @@ static bool test_if_create_new_users(THD *thd)
bzero((char*) &tl,sizeof(tl));
tl.db= (char*) "mysql";
tl.real_name= (char*) "user";
- tl.non_cachable_table= 1; // just safety for table on stack
+
db_access=acl_get(thd->host, thd->ip,
thd->priv_user, tl.db, 0);
if (!(db_access & INSERT_ACL))
@@ -2238,9 +2235,6 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
? tables+2 : 0);
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE;
tables[0].db=tables[1].db=tables[2].db=(char*) "mysql";
- // just safety for table on stack
- tables[0].non_cachable_table= tables[1].non_cachable_table=
- tables[2].non_cachable_table= 1;
#ifdef HAVE_REPLICATION
/*
@@ -2415,8 +2409,6 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
tables[0].lock_type=tables[1].lock_type=TL_WRITE;
tables[0].db=tables[1].db=(char*) "mysql";
tables[0].table=tables[1].table=0;
- // just safety for table on stack
- tables[0].non_cachable_table= tables[1].non_cachable_table= 1;
#ifdef HAVE_REPLICATION
/*
@@ -2536,8 +2528,6 @@ my_bool grant_init(THD *org_thd)
tables[0].next=tables+1;
tables[0].lock_type=tables[1].lock_type=TL_READ;
tables[0].db=tables[1].db=thd->db;
- // just safety for table on stack
- tables[0].non_cachable_table= tables[1].non_cachable_table= 1;
uint counter;
if (open_tables(thd, tables, &counter))
@@ -3375,9 +3365,6 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
tables->lock_type= (tables+1)->lock_type=
(tables+2)->lock_type= (tables+3)->lock_type= TL_WRITE;
tables->db= (tables+1)->db= (tables+2)->db= (tables+3)->db=(char*) "mysql";
- // just safety for table on stack
- tables[0].non_cachable_table= tables[1].non_cachable_table=
- tables[2].non_cachable_table= tables[3].non_cachable_table=1;
#ifdef HAVE_REPLICATION
/*
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index f70feb8dc9c..0862de073d3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -156,7 +156,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
table_list.db= (char*) entry->table_cache_key;
table_list.real_name= entry->real_name;
table_list.grant.privilege=0;
- table_list.non_cachable_table= 1; // just safety for table on stack
+
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1))
continue;
/* need to check if we haven't already listed it */
@@ -1333,7 +1333,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
bzero((char*) &table_list, sizeof(table_list)); // just for safe
table_list.db=(char*) db;
table_list.real_name=(char*) name;
- table_list.non_cachable_table= 1; // just safety for table on stack
+
safe_mutex_assert_owner(&LOCK_open);
if ((error=lock_table_name(thd,&table_list)))
@@ -1941,7 +1941,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
if (find)
{
(*where)= item->cached_table= tables;
- if (tables->non_cachable_table)
+ if (!tables->cacheable_table)
item->cached_table= 0;
if (find == WRONG_GRANT)
return (Field*) 0;
@@ -2002,7 +2002,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
if (field == WRONG_GRANT)
return (Field*) 0;
(*where)= item->cached_table= tables;
- if (tables->non_cachable_table)
+ if (!tables->cacheable_table)
item->cached_table= 0;
if (found)
{
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 985dac7d613..39061a6501b 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1022,7 +1022,6 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Query_cache_table *table = block_table->parent;
table_list.db = table->db();
table_list.alias= table_list.real_name= table->table();
- table_list.non_cachable_table= 1; // just safety for table on stack
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_table_access(thd,SELECT_ACL,&table_list,1))
{
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 29dab51839d..44293b8214f 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -670,9 +670,6 @@ int mysqld_help(THD *thd, const char *mask)
tables[3].lock_type= TL_READ;
tables[3].next= 0;
tables[0].db= tables[1].db= tables[2].db= tables[3].db= (char*) "mysql";
- // just safety for table on stack
- tables[0].non_cachable_table= tables[1].non_cachable_table=
- tables[2].non_cachable_table= tables[3].non_cachable_table= 1;
List<String> topics_list, categories_list, subcategories_list;
String name, description, example;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 3f943b3a4c6..0d0dff81427 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -82,7 +82,6 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
table_list.real_name= table_list.alias= table->table_name;
table_list.table=table;
table_list.grant=table->grant;
- table_list.non_cachable_table= 1;
thd->dupp_field=0;
if (setup_tables(&table_list) ||
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2b8720abebb..100db9d1686 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4554,6 +4554,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX);
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
ptr->derived= table->sel;
+ ptr->cacheable_table= 1;
if (use_index_arg)
ptr->use_index=(List<String> *) thd->memdup((gptr) use_index_arg,
sizeof(*use_index_arg));
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index bdbdcb28d3a..2b1adbf7afc 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -987,7 +987,7 @@ void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
int error;
DBUG_ENTER("mysql_stmt_prepare");
- DBUG_PRINT("pquery", ("%s", packet));
+ DBUG_PRINT("prep_query", ("%s", packet));
if (stmt == 0)
{
@@ -1133,7 +1133,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
if (!(stmt= find_prepared_statement(thd, stmt_id, "execute", SEND_ERROR)))
DBUG_VOID_RETURN;
- DBUG_PRINT("equery:", ("%s", stmt->query));
+ DBUG_PRINT("exec_query:", ("%s", stmt->query));
/* Check if we got an error when sending long data */
if (stmt->get_longdata_error)
diff --git a/sql/table.h b/sql/table.h
index 0bae880a89f..7b30b03f1b4 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -193,7 +193,7 @@ typedef struct st_table_list
bool updating; /* for replicate-do/ignore table */
bool force_index; /* Prefer index over table scan */
bool ignore_leaves; /* Preload only non-leaf nodes */
- bool non_cachable_table; /* stop PS caching */
+ bool cacheable_table; /* stop PS caching */
} TABLE_LIST;
typedef struct st_changed_table_list